annotate gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java @ 703:21ad44ccdb84

Tooltip text of the back-button became language specific (issue227). gnv/trunk@943 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 19 Apr 2010 08:37:35 +0000
parents 254f062e334b
children c7f8a9b4b006
rev   line source
29
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.action;
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2
683
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
3 import de.intevation.gnv.action.sessionmodel.DiagrammOptions;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
4 import de.intevation.gnv.action.sessionmodel.SessionModel;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
5 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
6
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
7 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
8 import de.intevation.gnv.artifactdatabase.objects.OutputMode;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
9 import de.intevation.gnv.artifactdatabase.objects.OutputParameter;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
10
663
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
11 import java.text.NumberFormat;
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
12 import java.text.ParseException;
683
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
13
30
07e9c137a2f1 Added dynamic Outputparameter Support and Outputparameter-manipulation
Tim Englich <tim.englich@intevation.de>
parents: 29
diff changeset
14 import java.util.Collection;
07e9c137a2f1 Added dynamic Outputparameter Support and Outputparameter-manipulation
Tim Englich <tim.englich@intevation.de>
parents: 29
diff changeset
15 import java.util.Iterator;
663
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
16 import java.util.Locale;
407
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
17 import java.util.Map;
30
07e9c137a2f1 Added dynamic Outputparameter Support and Outputparameter-manipulation
Tim Englich <tim.englich@intevation.de>
parents: 29
diff changeset
18
29
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import javax.servlet.http.HttpServletRequest;
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import javax.servlet.http.HttpServletResponse;
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 import org.apache.log4j.Logger;
683
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
23
29
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 import org.apache.struts.action.ActionForm;
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 import org.apache.struts.action.ActionForward;
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 import org.apache.struts.action.ActionMapping;
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 /**
690
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
29 * This controller is called to change options used in charts and histograms
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
30 * (e.g. width, height, etc).
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
31 *
684
57fa8019fbdc Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 683
diff changeset
32 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
29
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 */
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
34 public class ChangeOptionsAction extends DescribeUIAction {
29
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 /**
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 * the logger, used to log exceptions and additonaly information
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 */
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 private static Logger log = Logger.getLogger(ChangeOptionsAction.class);
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
39
29
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 /**
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 * Constructor
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 */
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 public ChangeOptionsAction() {
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 super();
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 }
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 @Override
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 public ActionForward execute(ActionMapping mapping, ActionForm form,
38
fccf90761825 Format Code to max 80 Chars per Row better Formatter choosen
Tim Englich <tim.englich@intevation.de>
parents: 36
diff changeset
49 HttpServletRequest request,
fccf90761825 Format Code to max 80 Chars per Row better Formatter choosen
Tim Englich <tim.englich@intevation.de>
parents: 36
diff changeset
50 HttpServletResponse response) throws Exception {
29
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 log.debug("NextArtifactStepAction.execute");
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
52 try {
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
53 SessionModel sm = SessionModelFactory.getInstance()
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
54 .getSessionModel(request);
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
55
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
56 ArtifactDescription ad = sm.getArtifactDescription();
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
57
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
58 String target = request.getParameter("target");
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
59 OutputMode outputMode = sm.getOutputMode(target);
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
60 if (outputMode != null) {
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
61
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
62 Collection<OutputParameter> op = outputMode
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
63 .getOutputParameters();
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
64 if (op != null) {
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
65 Iterator<OutputParameter> it = op.iterator();
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
66 DiagrammOptions diagrammOptions = new DiagrammOptions();
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
67 while (it.hasNext()) {
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
68 OutputParameter parameter = it.next();
663
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
69 String name = parameter.getName();
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
70 String old = parameter.getValue();
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
71 String value = request.getParameter(name);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
72 String type = parameter.getType();
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
73
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
74 if (log.isDebugEnabled()) {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
75 log.debug("Change chart options now...");
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
76 log.debug("Parameter name: " + name);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
77 log.debug("Parameter type: " + type);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
78 log.debug("Parameter value: " + value);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
79 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
80
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
81 if (type.equalsIgnoreCase("boolean")){
289
890d7a41ab93 Added Support for Boolean-Output-Parameters in Diagramm-Options
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
82 if (value == null){
890d7a41ab93 Added Support for Boolean-Output-Parameters in Diagramm-Options
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
83 value = "false";
890d7a41ab93 Added Support for Boolean-Output-Parameters in Diagramm-Options
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
84 }
407
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
85 else {
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
86 value = "true";
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
87 }
663
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
88
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
89 diagrammOptions.setValue(name,value);
289
890d7a41ab93 Added Support for Boolean-Output-Parameters in Diagramm-Options
Tim Englich <tim.englich@intevation.de>
parents: 157
diff changeset
90 }
663
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
91 else if (type.equalsIgnoreCase("integer")) {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
92 if (validInteger(request.getLocale(), value)) {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
93 diagrammOptions.setValue(name, value);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
94 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
95 else {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
96 log.warn("Text is not a valid integer: "+value);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
97 diagrammOptions.setValue(name, old);
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
98
663
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
99 request.setAttribute(
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
100 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE,
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
101 "input.not.a.integer"
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
102 );
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
103
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
104 request.setAttribute(
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
105 CommunicationKeys.REQUEST_EXCEPTION_VALUE,
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
106 value
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
107 );
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
108 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
109 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
110 else if (type.equalsIgnoreCase("double")) {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
111 if (validDouble(request.getLocale(), value)) {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
112 diagrammOptions.setValue(name, value);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
113 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
114 else {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
115 log.warn("Text is not a valid double: "+value);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
116 diagrammOptions.setValue(name, old);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
117
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
118 request.setAttribute(
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
119 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE,
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
120 "input.not.a.double"
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
121 );
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
122
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
123 request.setAttribute(
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
124 CommunicationKeys.REQUEST_EXCEPTION_VALUE,
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
125 value
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
126 );
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
127 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
128 }
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
129 }
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
130 sm.setDiagrammOptions(diagrammOptions);
575
a634d5ee961d Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 573
diff changeset
131
a634d5ee961d Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 573
diff changeset
132 // XXX Little workarround. We should implement a 'choice' type,
a634d5ee961d Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 573
diff changeset
133 // if we need further choice elements! (iw)
a634d5ee961d Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 573
diff changeset
134 String bintype = request.getParameter("bintype");
a634d5ee961d Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 573
diff changeset
135 if (bintype != null) {
a634d5ee961d Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 573
diff changeset
136 diagrammOptions.setValue("bintype", bintype);
a634d5ee961d Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 573
diff changeset
137 sm.setDiagrammOptions(diagrammOptions);
a634d5ee961d Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 573
diff changeset
138 request.setAttribute("bintype", bintype);
a634d5ee961d Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 573
diff changeset
139 }
30
07e9c137a2f1 Added dynamic Outputparameter Support and Outputparameter-manipulation
Tim Englich <tim.englich@intevation.de>
parents: 29
diff changeset
140 }
07e9c137a2f1 Added dynamic Outputparameter Support and Outputparameter-manipulation
Tim Englich <tim.englich@intevation.de>
parents: 29
diff changeset
141 }
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
142
407
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
143 Map tmpOuts = ad.getOutputModes();
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
144 if (tmpOuts == null || tmpOuts.isEmpty()) {
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
145 request.setAttribute("furthertargets", true);
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
146 }
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
147 else {
573
bd67164cf28b Devided actions and exports. Adjusted output and export actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 571
diff changeset
148 request.setAttribute(target, true);
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
149 }
407
55dae5bb76db Fixed issue149. Render the chart if there are output modes existing for this state - not if there are further states. TODO: We should check if there is an output mode named 'chart' before rendering a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 389
diff changeset
150
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
151 return super.execute(mapping, form, request, response);
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
152 } catch (Exception e) {
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
153 log.error(e, e);
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
154 request.setAttribute(
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
155 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 34
diff changeset
156 .getMessage());
34
25fdec8b4c69 Added Global Errorhandling to the GNV-Client
Tim Englich <tim.englich@intevation.de>
parents: 30
diff changeset
157 return super.getExceptionForward(mapping);
30
07e9c137a2f1 Added dynamic Outputparameter Support and Outputparameter-manipulation
Tim Englich <tim.englich@intevation.de>
parents: 29
diff changeset
158 }
29
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 }
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160
663
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
161 protected boolean validInteger(Locale locale, String value) {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
162 try {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
163 if (value.split("\\.").length > 1 || value.split("\\,").length > 1){
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
164 return false;
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
165 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
166
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
167 NumberFormat format = NumberFormat.getIntegerInstance(locale);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
168 format.setParseIntegerOnly(true);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
169 Number number = format.parse(value);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
170
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
171 if (number.longValue() < 0)
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
172 return false;
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
173
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
174 return (number instanceof Integer) || (number instanceof Long);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
175 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
176 catch (ParseException pe) {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
177 return false;
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
178 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
179 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
180
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
181 protected boolean validDouble(Locale locale, String value) {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
182 try {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
183 NumberFormat format = NumberFormat.getInstance(locale);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
184 Number number = format.parse(value);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
185
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
186 if (number.doubleValue() < 0)
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
187 return false;
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
188
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
189 return (number instanceof Double) || validInteger(locale, value);
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
190 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
191 catch (ParseException pe) {
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
192 return false;
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
193 }
9a019c125b60 Improved error handling when changing chart/histogram options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 575
diff changeset
194 }
29
bba8fd97e549 Export and Diagrammoptions integrated into GUI
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
195 }
409
df78178e1180 Moved user interface creation to an own action. This makes avoids code duplication and makes it easier to write new action to handle special interactions, because there is no need for parsing the describe document and creating the user interface after this.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
196 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org