comparison gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp @ 408:b5733f9f386b

Design improvements: Moved chart option panel and export actions beneath the parameterization panel on the left side. Do not render a useless 'draw' button after reaching the final state. gnv/trunk@594 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 22 Jan 2010 09:49:34 +0000
parents 9005b39c52ac
children 9602f4bffc07
comparison
equal deleted inserted replaced
407:55dae5bb76db 408:b5733f9f386b
4 <%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%> 4 <%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%>
5 <%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%> 5 <%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%>
6 <%@page import="java.util.Collection"%> 6 <%@page import="java.util.Collection"%>
7 <%@page import="java.util.Iterator"%> 7 <%@page import="java.util.Iterator"%>
8 <%@page import="java.net.URLEncoder"%> 8 <%@page import="java.net.URLEncoder"%>
9 <%Object diagramm = request.getAttribute("diagramm"); 9 <%
10 SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); 10 // fetch diagramm parameter from request if the user clicked 'draw'
11 if (diagramm != null){ 11 Object diagramm = request.getAttribute("diagramm");
12 String target = "chart"; 12 SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
13 String targetCSV = "csv"; 13
14 String targetODV = "odv"; 14 String target = "chart";
15 String targetPDF = "pdf"; 15 String mimeType = null;
16 String targetSVG = "svg"; 16 String parameterString = "";
17 String targetZIP = "zip"; 17
18 String targetWMS = "wms";
19 boolean supportChart = sm.getOutputMode(target) != null; 18 boolean supportChart = sm.getOutputMode(target) != null;
20 boolean supportCSV = sm.getOutputMode(targetCSV) != null; 19
21 boolean supportODV = sm.getOutputMode(targetODV) != null;
22 boolean supportPDF = sm.getOutputMode(targetPDF) != null;
23 boolean supportSVG = sm.getOutputMode(targetSVG) != null;
24 boolean supportZIP = sm.getOutputMode(targetZIP) != null;
25 boolean supportWMS = sm.getOutputMode(targetWMS) != null;
26 String mimeType = null;
27 String parameterString = "";
28 if (supportChart){ 20 if (supportChart){
29 mimeType = sm.getOutputMode(target).getMimeType(); 21 mimeType = sm.getOutputMode(target).getMimeType();
30 DiagrammOptions diagrammOptions = sm.getDiagrammOptions(); 22 DiagrammOptions diagrammOptions = sm.getDiagrammOptions();
31 Collection<OutputParameter> op = sm.getOutputMode(target).getOutputParameters(); 23 Collection<OutputParameter> op = sm.getOutputMode(target).getOutputParameters();
24
32 if (op != null){ 25 if (op != null){
33 Iterator<OutputParameter> it = op.iterator(); 26 Iterator<OutputParameter> it = op.iterator();
34 while (it.hasNext()){ 27 while (it.hasNext()){
35 OutputParameter parameter = it.next(); 28 OutputParameter parameter = it.next();
36 parameterString = parameterString +"&"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue()); 29 parameterString = parameterString +"&"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue());
37 } 30 }
38 } 31 }
39 } 32 }
40 String mimeTypePDF = null; 33 %>
41 if (supportPDF) {
42 mimeTypePDF = sm.getOutputMode(targetPDF).getMimeType();
43 }
44 String mimeTypeSVG = null;
45 if (supportSVG) {
46 mimeTypeSVG = sm.getOutputMode(targetSVG).getMimeType();
47 mimeTypeSVG = URLEncoder.encode(mimeTypeSVG, "UTF-8");
48 }
49 String mimeTypeCSV = null;
50 if (supportCSV){
51 mimeTypeCSV = sm.getOutputMode(targetCSV).getMimeType();
52 }
53 34
54 String mimeTypeODV = null; 35 <%-- show chart options if output mode 'chart' is supported --%>
55 if (supportODV){ 36 <% if (supportChart) { %>
56 mimeTypeODV = sm.getOutputMode(targetODV).getMimeType(); 37 <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp"></jsp:include>
57 } 38 <%}%>
58 39
59 String mimeTypeZIP = null; 40 <%-- diagramm is not null if the user clicked the 'draw' button --%>
60 if (supportZIP) { 41 <%if (diagramm != null) { %>
61 mimeTypeZIP = sm.getOutputMode(targetZIP).getMimeType(); 42 <div id="diagram">
62 } 43 <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&amp;target="+target+parameterString+"&amp;uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.diagramm.alt"/>'/>
63
64 String mimeTypeWMS = null;
65 if (supportWMS) {
66 mimeTypeWMS = sm.getOutputMode(targetWMS).getMimeType();
67 }
68 %>
69 <div id="diagram">
70 <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&target="+target+parameterString+"&uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.diagramm.alt"/>'/>
71 <br/> 44 <br/>
72 <div id="export">
73 <%if (supportChart) { %>
74 <a href="<%=response.encodeURL("export.do?mimetype="+mimeType+"&target="+target+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.save.title"/>">
75 <img src="images/diagram_export.png" border="0"/>
76 </a>
77 <%}%>
78 <%if (supportPDF) { %>
79 <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypePDF+"&target="+targetPDF+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.pdf.title"/>">
80 <img src="images/pdf.png" border="0"/>
81 </a>
82 <%}%>
83 <%if (supportSVG) { %>
84 <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeSVG+"&target="+targetSVG+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.svg.title"/>">
85 <img src="images/svg.png" border="0"/>
86 </a>
87 <%}%>
88 <%if (supportCSV) { %>
89 <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeCSV+"&target="+targetCSV+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.csv.title"/>">
90 <img src="images/data_export.png" border="0"/>
91 </a>
92 <%}%>
93 <%if (supportODV) { %>
94 <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeODV+"&target="+targetODV+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.odv.title"/>">
95 <img src="images/data_export.png" border="0"/>
96 </a>
97 <%}%>
98 <%if (supportWMS) { %>
99 <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeWMS+"&target="+targetWMS+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.wms.title"/>">
100 <img src="images/map_go.png" border="0"/>
101 </a>
102 <%}%>
103 <%if (supportZIP) { %>
104 <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeZIP+"&target="+targetZIP+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.zip.title"/>">
105 <img src="images/disk.png" border="0"/>
106 </a>
107 <%}%>
108 </div>
109 <%if (supportChart) { %>
110 <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_adons_inc.jsp"></jsp:include>
111 <%}%>
112 </div> 45 </div>
113 <%}%> 46 <%}%>

http://dive4elements.wald.intevation.org