diff gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java @ 13:2535158e2687

Chartoutput Added to the View gnv/trunk@95 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Wed, 16 Sep 2009 12:41:27 +0000
parents 4ebe57b170d3
children d7e5a929fc34
line wrap: on
line diff
--- a/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java	Wed Sep 16 07:44:26 2009 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java	Wed Sep 16 12:41:27 2009 +0000
@@ -62,15 +62,28 @@
                 ips.add(ip);
             }
         }
-        // TODO: Woher kommt der zu erreichende Status;
-        String target = ad.getReachableStates().iterator().next();
         ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient();
-        ArtifactDescription artifactDescription = adc.doNextStep(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), target, ips);
-        
-        XSLTransformer transformer = new XSLTransformer();
-        String ui = transformer.transform(artifactDescription.getCurrentUI(), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
-        
-        request.setAttribute("ui", ui);
+        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);
+            
+            XSLTransformer transformer = new XSLTransformer();
+            String ui = transformer.transform(artifactDescription.getCurrentUI(), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
+            
+            request.setAttribute("ui", ui);
+        }else{
+            
+            adc.doFeed(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), ips);
+            String mimeType = "image/png";
+            String target = "chart";
+                
+            String src = "<img src='out.do?mimetype="+mimeType+"&target="+target+"&uid="+System.currentTimeMillis()+"' alt='Chart'>";
+            request.setAttribute("ui", src);
+            
+        }
         
         return super.execute(mapping, form, request, response);
     }

http://dive4elements.wald.intevation.org