# HG changeset patch # User Sascha L. Teichmann # Date 1276207283 0 # Node ID 9b126bceb0b2357fe9f50065069538f91723229e # Parent 9ff116474e7b0035e811119d5d6959f5415fdbad gnv/issue219: Added rendering of direct links. gnv/trunk@1194 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 9ff116474e7b -r 9b126bceb0b2 gnv/ChangeLog --- a/gnv/ChangeLog Thu Jun 10 16:48:30 2010 +0000 +++ b/gnv/ChangeLog Thu Jun 10 22:01:23 2010 +0000 @@ -1,3 +1,34 @@ +2010-06-10 Sascha L. Teichmann + + Issue 219 + + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java: + Broke over long line. + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Fed + more parameters into XSL transformation to allow better form rendering. + + * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java: + use explicit boolean to indicate that we are still able to advance. + + * src/main/java/de/intevation/gnv/util/XSLTransformer.java: Removed + stupid initial size of hash map. + + * src/main/webapp/styles/gnv.css: Added style to render direct + links to look like buttons. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added a few + forwards. The log is full of unresolvable forwards. TODO: This + needs to be checked and is not a problem introduced by direct + link feature. + + * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Render + the direct links if there are less than six item in a single + select list. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Cleanup a bit. Removed + form rendering here and moved it into the dynamic XSL transformation. + 2010-06-10 Ingo Weinzierl * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Removed some diff -r 9ff116474e7b -r 9b126bceb0b2 gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java --- a/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java Thu Jun 10 16:48:30 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java Thu Jun 10 22:01:23 2010 +0000 @@ -25,6 +25,8 @@ import de.intevation.gnv.util.XMLUtils; import de.intevation.gnv.util.XSLTransformer; +import org.apache.log4j.Logger; + /** * This controller is called to fetch the current artifact description using the * describe operation. The describe document is used to feed an XSL transformer @@ -36,6 +38,9 @@ */ public class DescribeUIAction extends ArtifactDatabaseActionBase { + private static Logger log = Logger + .getLogger(DescribeUIAction.class); + public static final String XPATH_DYNAMIC_UI = "art:dynamic"; public static final String XPATH_STATIC_UI = "art:static"; @@ -58,6 +63,11 @@ super(); } + public static String getInputException(HttpServletRequest request) { + Object msg = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID); + return msg != null ? msg.toString() : ""; + } + @Override public ActionForward execute( @@ -104,8 +114,10 @@ if (currentUI != null) { ResourceBundle res = ResourceBundle.getBundle( "applicationMessages", locale); - String editText = res.getString( + String editText = res.getString( "gnviewer.history.back.button"); + String submitButton = res.getString( + "gnviewer.select.button.src"); String exampleLinestring = res.getString( "gnviewer.example.linestring"); String examplePolygon = res.getString( @@ -113,12 +125,37 @@ XSLTransformer transformer = new XSLTransformer(); + String nextUrl = response.encodeURL( + mapping.findForward("next").getPath()); + String url = response.encodeURL( mapping.findForward("back").getPath()); + + + transformer.addParameter( + "uuid", + sm.getCurrentArtifact().getDescription()); + + transformer.addParameter( + "exception", + getInputException(request)); + + + Object ft = request.getAttribute("furthertargets"); + + transformer.addParameter("further", + ft == null || (ft instanceof Boolean && ((Boolean)ft).booleanValue()) + ? "true" + : "false"); + + transformer.addParameter("next-url", nextUrl); transformer.addParameter("back-url", url); transformer.addParameter("edit", editText); transformer.addParameter("example-polygon", examplePolygon); transformer.addParameter( + "gnviewer-select-button-src", + submitButton); + transformer.addParameter( "example-linestring", exampleLinestring); @@ -135,10 +172,9 @@ ); String ui = transformer.transform( - dynamicNode, + dynamicNode.getParentNode(), "UTF-8", - request.getRealPath(XSL_SHEET_DYNAMIC - )); + request.getRealPath(XSL_SHEET_DYNAMIC)); if (ui != null && ui.length() > 1) request.setAttribute("ui", ui); diff -r 9ff116474e7b -r 9b126bceb0b2 gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java --- a/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java Thu Jun 10 16:48:30 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java Thu Jun 10 22:01:23 2010 +0000 @@ -98,7 +98,7 @@ ); } catch (ArtifactDatabaseInputException e) { - log.error(e, e); + log.debug(e, e); request.setAttribute( CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID, e.getMessage()); @@ -113,7 +113,7 @@ Map tmpOuts = ad.getOutputModes(); request.setAttribute( "furthertargets", - tmpOuts == null || tmpOuts.isEmpty() + Boolean.valueOf(tmpOuts == null || tmpOuts.isEmpty()) ); } else { try{ @@ -139,7 +139,7 @@ e.getMessage()); } - request.setAttribute("furthertargets", false); + request.setAttribute("furthertargets", Boolean.FALSE); } }else{ log.warn("SessionTimeout has occured"); diff -r 9ff116474e7b -r 9b126bceb0b2 gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java --- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java Thu Jun 10 16:48:30 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java Thu Jun 10 22:01:23 2010 +0000 @@ -25,9 +25,11 @@ */ public interface ArtifactDatabaseClient { - public final static String ARTIFACTDATABASE_COUNT_ID = "de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.count"; + public final static String ARTIFACTDATABASE_COUNT_ID = + "de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.count"; - public final static String ARTIFACTDATABASE_URL_ID = "de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.url"; + public final static String ARTIFACTDATABASE_URL_ID = + "de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.url"; /** * Return the Artifactfactories which can be resolved. diff -r 9ff116474e7b -r 9b126bceb0b2 gnv/src/main/java/de/intevation/gnv/util/XSLTransformer.java --- a/gnv/src/main/java/de/intevation/gnv/util/XSLTransformer.java Thu Jun 10 16:48:30 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/util/XSLTransformer.java Thu Jun 10 22:01:23 2010 +0000 @@ -98,7 +98,7 @@ */ public void addParameter(String name, String value) { if (params == null) { - params = new HashMap(3); + params = new HashMap(); } params.put(name, value); diff -r 9ff116474e7b -r 9b126bceb0b2 gnv/src/main/webapp/WEB-INF/config/struts-config.xml --- a/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Thu Jun 10 16:48:30 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Thu Jun 10 22:01:23 2010 +0000 @@ -91,6 +91,9 @@ + @@ -106,6 +109,9 @@ name="back" path="/gnv/back.do"/> + @@ -124,6 +130,9 @@ + @@ -149,6 +158,9 @@ + @@ -180,6 +192,9 @@ + @@ -194,6 +209,9 @@ + @@ -208,6 +226,9 @@ + @@ -219,6 +240,9 @@ type="de.intevation.gnv.action.ShowStatisticAction" scope="request" validate="false"> + @@ -237,6 +261,9 @@ name="back" path="/gnv/back.do"/> + + diff -r 9ff116474e7b -r 9b126bceb0b2 gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl --- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl Thu Jun 10 16:48:30 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl Thu Jun 10 22:01:23 2010 +0000 @@ -11,19 +11,45 @@ + /gnv/next.do + false + + ./images/auswaehlen.png + + +
+
+
+ +
+
+ +

Here i am

+

""

+ +
+ +
+
+
+
+
- + - + @@ -38,12 +64,12 @@ @@ -51,7 +77,7 @@ - + @@ -77,7 +103,7 @@ - + @@ -87,7 +113,7 @@ - +
@@ -152,7 +178,7 @@
- + @@ -181,7 +207,7 @@ - + diff -r 9ff116474e7b -r 9b126bceb0b2 gnv/src/main/webapp/WEB-INF/jsp/index.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Thu Jun 10 16:48:30 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Thu Jun 10 22:01:23 2010 +0000 @@ -1,13 +1,10 @@ <%@ 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="java.util.Collection"%> <%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactObject"%> <%@page import="de.intevation.gnv.action.CommunicationKeys"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> -<%@page import="java.util.Iterator"%> <% - String exception = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID); SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); Object ui = request.getAttribute("ui"); Object staticui = request.getAttribute("staticui"); @@ -15,7 +12,6 @@ Object statistic = request.getAttribute("statistic"); Object histogram = request.getAttribute("histogram"); Object wms_published = request.getAttribute("wms_published"); - boolean furthertargets = true; if (chart == null && statistic == null && histogram == null && wms_published == null) { boolean supportChart = sm.getOutputMode("chart") != null; @@ -24,10 +20,6 @@ } } - Object furthertargetsObject = request.getAttribute("furthertargets"); - if (furthertargetsObject != null){ - furthertargets = ((Boolean)furthertargetsObject).booleanValue(); - } Object exceptionMessage = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID); exceptionMessage = (exceptionMessage != null ? exceptionMessage.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null); @@ -94,24 +86,8 @@ <%}%> <%-- render the dynamic part to feed the state and advance to the next state --%> - <%if (ui != null){%> -
-
" method="post"> -
- - <%-- error message, if user input was not valid --%> - <%if (exception != null) {%> -
<%=exception%>
- <%}%> - <%=ui != null ? ui.toString().replaceAll(" ", "") : "" %> - - <%if(furthertargets){%> -
- "/> - <%}%> -
-
-
+ <%if (ui != null) { %> + <%= ui.toString().replaceAll(" ", "") %> <%}%> <%-- render export options if existing for this state --%> diff -r 9ff116474e7b -r 9b126bceb0b2 gnv/src/main/webapp/styles/gnv.css --- a/gnv/src/main/webapp/styles/gnv.css Thu Jun 10 16:48:30 2010 +0000 +++ b/gnv/src/main/webapp/styles/gnv.css Thu Jun 10 22:01:23 2010 +0000 @@ -117,6 +117,14 @@ } /* Some classes for the content */ +a.linkButton { + border: 1px solid #000000; + color: #ff6600; + font-size: 1.2em; + padding: 1px; + text-decoration: none; +} + #contentElement { float: left; height: 90%;