changeset 18:87002cbd194c

Static UI -integration an some refactoringwork done gnv/trunk@103 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Thu, 17 Sep 2009 14:30:16 +0000 (2009-09-17)
parents d7e5a929fc34
children 1557bea6cb55
files gnv/Changelog gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp gnv/src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp gnv/src/main/webapp/WEB-INF/jsp/index.jsp gnv/src/main/webapp/styles/default.css
diffstat 8 files changed, 163 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/Changelog	Wed Sep 16 14:55:54 2009 +0000
+++ b/gnv/Changelog	Thu Sep 17 14:30:16 2009 +0000
@@ -1,3 +1,35 @@
+2009-09-17  Tim Englich  <tim.englich@intevation.de>
+
+    * src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: 
+      Some Refactoring work done.
+    * src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: 
+      Added XSL-Template for Transforming the stazic UI
+    * src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp: 
+      Refactored FIS Rendering to it's own Include-File
+    * src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp: 
+      Refactored Diagramm Rendering to it's own Include-File
+    * src/main/webapp/WEB-INF/jsp/index.jsp: 
+      Some Refactoring Work done.
+    * src/main/webapp/styles/default.css: 
+      Some Changes in DIV-Formatting to get a propper Layout.
+      
+    * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java (NextArtifactStepAction): 
+      Static UI integrated
+      
+2009-09-17  Tim Englich  <tim.englich@intevation.de>
+
+    * src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp: 
+      Refactored FIS Rendering to it's own Include-File
+    * src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp: 
+      Refactored Diagramm Rendering to it's own Include-File
+    * src/main/webapp/WEB-INF/jsp/index.jsp: 
+      Some Refactoring Work done.
+    * src/main/webapp/styles/default.css: 
+      Some Changes in DIV-Formatting to get a propper Layout.
+      
+    * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java (NextArtifactStepAction): 
+      Static UI integrated
+      
 2009-09-16  Tim Englich  <tim.englich@intevation.de>
 
     * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java (execute) Edited:
--- a/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java	Wed Sep 16 14:55:54 2009 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java	Thu Sep 17 14:30:16 2009 +0000
@@ -14,6 +14,7 @@
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
+import org.w3c.dom.Node;
 
 import de.intevation.gnv.action.sessionmodel.SessionModel;
 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
@@ -22,6 +23,7 @@
 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
 import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter;
 import de.intevation.gnv.artifactdatabase.objects.InputParameter;
+import de.intevation.gnv.util.XMLUtils;
 import de.intevation.gnv.util.XSLTransformer;
 
 /**
@@ -66,15 +68,18 @@
         if (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()){
             // TODO: Woher kommt der zu erreichende Status;
             String target = ad.getReachableStates().iterator().next();
-                    
             
             ArtifactDescription artifactDescription = adc.doNextStep(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), target, ips);
             
+            Node currentUI = artifactDescription.getCurrentUI();
             XSLTransformer transformer = new XSLTransformer();
-            String ui = transformer.transform(artifactDescription.getCurrentUI(), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
+            String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
             
             request.setAttribute("ui", ui);
             
+            String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl"));
+            request.setAttribute("staticui", staticUI);
+            
             request.setAttribute("furthertargets", (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()));
             
         }else{
@@ -88,10 +93,15 @@
             
             ArtifactDescription artifactDescription = adc.getCurrentStepDescription(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact());
             
+            Node currentUI = artifactDescription.getCurrentUI();
             XSLTransformer transformer = new XSLTransformer();
-            String ui = transformer.transform(artifactDescription.getCurrentUI(), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
+            String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
+                
+            request.setAttribute("ui", ui);
             
-            request.setAttribute("ui", ui);
+            String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl"));
+            request.setAttribute("staticui", staticUI);
+            
             request.setAttribute("furthertargets",false);
         }
         
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl	Thu Sep 17 14:30:16 2009 +0000
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" 
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+                xmlns="http://www.w3.org/2002/xforms" 
+                xmlns:xform="http://www.w3.org/2002/xforms" 
+                xmlns:art="http://www.intevation.de/2009/artifacts">
+    <xsl:output method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>
+    
+    <xsl:template match="*[local-name() = 'select']">
+        <xsl:variable name="selectName" select="@ref"/>
+             <div id="timeseriesfilter">
+                <form id="{$selectName}Form" method="post">
+                   <fieldset>
+                    <legend><xsl:value-of select="@ref"/></legend>
+                    <select name="{$selectName}" multiple="multiple" size="6" disabled="disabled"> <xsl:apply-templates/></select>
+                    </fieldset>
+                </form>
+             </div> 
+    </xsl:template>
+    <xsl:template match="*[local-name() = 'select1']">
+        <xsl:variable name="selectName" select="@ref"/>
+            <div id="timeseriesfilter">
+                <form id="{$selectName}Form" method="post">
+                   <fieldset>
+                    <legend><xsl:value-of select="@ref"/></legend>
+                    <select name="{$selectName}" disabled="disabled"> <xsl:apply-templates/></select>
+                    </fieldset>
+                </form>
+             </div>
+    </xsl:template>
+    <xsl:template match="*[local-name() = 'item']">
+        <xsl:variable name="optionValue" select="*[local-name() = 'value']"/>
+        <xsl:choose>
+           <xsl:when test="@selected = 'true'">
+               <option value="{$optionValue}" selected="selected"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option>
+           </xsl:when>
+           <xsl:otherwise>
+               <option value="{$optionValue}"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option>
+           </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <xsl:template match="*[local-name() = 'input']">
+        <xsl:variable name="inputValue" select="*[local-name() = 'value']"/>
+        <xsl:variable name="inputName" select="*[local-name() = 'label']"/>
+        <xsl:value-of select="*[local-name() = 'label']"/>: <input type="text" id="{$inputName}" name="{$inputName}" value="{$inputValue}" /><br/> 
+    </xsl:template>
+    
+    <xsl:template match="*[local-name() = 'label']">
+    </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Wed Sep 16 14:55:54 2009 +0000
+++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Thu Sep 17 14:30:16 2009 +0000
@@ -6,9 +6,6 @@
                 xmlns:art="http://www.intevation.de/2009/artifacts">
     <xsl:output method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>
     
-    <xsl:template match="*[local-name() = 'ui']">
-        <xsl:apply-templates/>
-    </xsl:template>
     <xsl:template match="*[local-name() = 'select']">
         <xsl:variable name="selectName" select="@ref"/>
 	                <legend><xsl:value-of select="@ref"/></legend>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp	Thu Sep 17 14:30:16 2009 +0000
@@ -0,0 +1,6 @@
+<%Object diagramm = request.getAttribute("diagramm");%>
+<%if (diagramm != null){ %>
+    <div id="diagram">
+        <%=diagramm.toString()%>
+    </div>
+<%}%>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp	Thu Sep 17 14:30:16 2009 +0000
@@ -0,0 +1,29 @@
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@page import="java.util.Collection"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactObject"%>
+<%@page import="java.util.Iterator"%>
+<%
+  SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
+  Collection<ArtifactObject> artifactFactories = sm.getArtifactFactories();
+%>
+<div id="basefilter">
+    <form id="fisSelectionForm" action="selectArtifactFactory.do" method="post">
+       <fieldset>
+            <legend><bean:message key="gnviewer.productselection.fisselection.title"/></legend>
+      <%if (artifactFactories != null){%>
+           
+           <select name="artifactFactory">
+           <%Iterator<ArtifactObject> it = artifactFactories.iterator();
+           while (it.hasNext()){
+                ArtifactObject ao = it.next();%>
+                <option value="<%=ao.getId()%>" <%=(ao.isSelected() ? "selected=\"selected\"" : "")%> ><%=ao.getName()%></option>
+           <%}%>
+           </select>
+    <%}%>
+           <br/>
+           <input type="submit" value="<bean:message key="gnviewer.select.button"/>" />
+        </fieldset>
+    </form>
+</div>
\ No newline at end of file
--- a/gnv/src/main/webapp/WEB-INF/jsp/index.jsp	Wed Sep 16 14:55:54 2009 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/index.jsp	Thu Sep 17 14:30:16 2009 +0000
@@ -1,56 +1,38 @@
-
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
 <%@page import="java.util.Collection"%>
 <%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactObject"%>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
 <%@page import="java.util.Iterator"%>
 <%Object ui = request.getAttribute("ui");
+  Object staticui = request.getAttribute("staticui");
   boolean furthertargets = true;
       
   Object furthertargetsObject = request.getAttribute("furthertargets");
   if (furthertargetsObject != null){
       furthertargets = ((Boolean)furthertargetsObject).booleanValue();
   }
-  Object diagramm = request.getAttribute("diagramm");
-  String action = (ui == null ? "selectArtifactFactory.do" : "next.do");
 %>
-<div id="basefilter">
-	<form id="fisSelectionForm" action="<%=action%>" method="post">
-	   <fieldset>
-	   
-	<%
-	  
-	  SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
-	  Collection<ArtifactObject> artifactFactories = sm.getArtifactFactories();
-	  if (artifactFactories != null && ui == null){
-	%>
-	       <legend>FIS</legend>
-	       <select name="artifactFactory">
-	<%
-	      Iterator<ArtifactObject> it = artifactFactories.iterator();
-	      while (it.hasNext()){
-	          ArtifactObject ao = it.next();
-	      
-	%>
-	    
-	           <option value="<%=ao.getId()%>" <%=(ao.isSelected() ? "selected=\"selected\"" : "")%> ><%=ao.getName()%></option>
-	<%
-	      }
-	%>
-	       </select>
-	<%
-	}
-	%>
-	
-	    
-	    <%=ui != null ? ui.toString() : "" %>
-	    
-	       <input type="submit" value="<%=furthertargets ? "Ausw�hlen" : "Zeichen"%>" />
-	    </fieldset>
-	</form>
-</div>
-<%if (diagramm != null){ %>
-<div id="diagram">
-    <%=diagramm.toString()%>
-</div>
-<%}%>
\ No newline at end of file
+    <div>
+    <jsp:include page="includes/display_fis_inc.jsp"></jsp:include>
+    <%if (staticui != null){ %>
+        <%=staticui.toString()%>
+    <%}%>
+    
+    <%if (ui != null){%>
+    <div id="timeseriesfilter">
+        <form id="fisSelectionForm" action="next.do" method="post">
+           <fieldset>
+            <%=ui != null ? ui.toString() : "" %>
+            <br/>
+            <%if(furthertargets){%>
+            <input type="submit" value="<bean:message key="gnviewer.select.button"/>"/>
+            <%}else{%>
+            <input type="submit" value="<bean:message key="gnviewer.draw.button"/>"/>
+            <%}%>
+            </fieldset>
+        </form>
+    </div>
+    <%}%>
+    </div>
+    <jsp:include page="includes/display_diagramm_inc.jsp"></jsp:include>
\ No newline at end of file
--- a/gnv/src/main/webapp/styles/default.css	Wed Sep 16 14:55:54 2009 +0000
+++ b/gnv/src/main/webapp/styles/default.css	Thu Sep 17 14:30:16 2009 +0000
@@ -212,8 +212,8 @@
 /*POSITION DEFINIEREN*/
 /* border: 1px solid crimson;*/
     position: absolute;
-    top: 170px;
-    left: 300px;
+    top: 65px;
+    left: 350px;
 }
 
 div#export {
@@ -295,15 +295,15 @@
  	left:410px;	
 }
 
-body > div#page >div#basefilter {
+div#basefilter {
     margin-top: 30px;
-    float: left;
-    width: 300px;
+    width: 325px;
 }
 
 div#timeseriesfilter {
     margin-top: 1px;
     padding: 0px;
+    width: 325px;
 }
 
 #timeRangeForm label {

http://dive4elements.wald.intevation.org