Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java @ 1607:64e3d4b024b1
Added Change accidentally ommitted to commit in rev 3960.
flys-client/trunk@3968 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 08 Feb 2012 13:56:28 +0000 |
parents | ef745bc6bed9 |
children | 8c1f90e380a3 |
rev | line source |
---|---|
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.InputStream; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.io.IOException; |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
5 import java.util.ArrayList; |
1597
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
6 import java.util.Date; |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
7 import java.util.List; |
549
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
8 import java.util.Map; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import javax.xml.xpath.XPathConstants; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import org.w3c.dom.Document; |
1597
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
13 import org.w3c.dom.Element; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.w3c.dom.Node; |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
15 import org.w3c.dom.NodeList; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
17 import org.apache.log4j.Logger; |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
18 |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifacts.common.utils.XMLUtils; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.artifacts.httpclient.http.HttpClient; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.client.shared.Transform2D; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.flys.client.shared.exceptions.ServerException; |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
30 import de.intevation.flys.client.shared.model.Axis; |
1597
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
31 import de.intevation.flys.client.shared.model.DateAxis; |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
32 import de.intevation.flys.client.shared.model.NumberAxis; |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
33 import de.intevation.flys.client.shared.model.ChartInfo; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 import de.intevation.flys.client.shared.model.Collection; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 import de.intevation.flys.client.client.services.ChartInfoService; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 /** |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 * This service fetches a document that contains meta information for a specific |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 * chart. |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 */ |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 public class ChartInfoServiceImpl |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 extends RemoteServiceServlet |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 implements ChartInfoService |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
49 private static final Logger logger = |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
50 Logger.getLogger(ChartInfoServiceImpl.class); |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
51 |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
52 |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 public static final String XPATH_TRANSFORM_MATRIX = |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
54 "/art:chartinfo/art:transformation-matrix/art:matrix"; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
56 public static final String XPATH_X_AXES = |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
57 "/art:chartinfo/art:axes/art:domain"; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
58 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
59 public static final String XPATH_Y_AXES = |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
60 "/art:chartinfo/art:axes/art:range"; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
61 |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 public static final String EXCEPTION_STRING = "error_chart_info_service"; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
65 public ChartInfo getChartInfo( |
549
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
66 Collection collection, |
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
67 String locale, |
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
68 String type, |
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
69 Map<String, String> attr) |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 throws ServerException |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
72 logger.info("ChartInfoServiceImpl.getChartInfo"); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
1425
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1367
diff
changeset
|
74 String url = getServletContext().getInitParameter("server-url"); |
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1367
diff
changeset
|
75 |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 Document request = ClientProtocolUtils.newOutCollectionDocument( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 collection.identifier(), |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 type, |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 type, |
549
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
80 ChartServiceHelper.getChartAttributes(attr)); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 try { |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 HttpClient client = new HttpClientImpl(url, locale); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 InputStream in = client.collectionOut( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 request, |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 collection.identifier(), |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 type + "_chartinfo"); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 Document info = XMLUtils.parseDocument(in); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 return parseInfoDocument(info); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 catch (IOException ioe) { |
556
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
94 ioe.printStackTrace(); |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
95 } |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
96 catch (Exception e) { |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
97 e.printStackTrace(); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
100 logger.debug("Error while fetching chart info."); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 throw new ServerException(EXCEPTION_STRING); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
106 protected ChartInfo parseInfoDocument(Document doc) { |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
107 Transform2D[] transformer = parseTransformationMatrix(doc); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
108 Axis[] xAxes = parseXAxes(doc); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
109 Axis[] yAxes = parseYAxes(doc); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
110 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
111 return new ChartInfo(xAxes, yAxes, transformer); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
112 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
113 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
114 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
115 protected Axis[] parseXAxes(Document doc) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
116 logger.debug("ChartInfoServiceImpl.parseXAxes"); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
117 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
118 NodeList axes = (NodeList) XMLUtils.xpath( |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
119 doc, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
120 XPATH_X_AXES, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
121 XPathConstants.NODESET, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
122 ArtifactNamespaceContext.INSTANCE); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
123 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
124 return parseAxes(axes); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
125 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
126 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
127 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
128 protected Axis[] parseYAxes(Document doc) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
129 logger.debug("ChartInfoServiceImpl.parseYAxes"); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
130 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
131 NodeList axes = (NodeList) XMLUtils.xpath( |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
132 doc, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
133 XPATH_Y_AXES, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
134 XPathConstants.NODESET, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
135 ArtifactNamespaceContext.INSTANCE); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
136 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
137 return parseAxes(axes); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
138 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
139 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
140 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
141 protected Axis[] parseAxes(NodeList axes) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
142 logger.debug("ChartInfoServiceImpl.parseAxes"); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
143 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
144 int count = axes != null ? axes.getLength() : 0; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
145 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
146 logger.debug("Chart has " + count + " axes."); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
147 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
148 if (count == 0) { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
149 return null; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
150 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
151 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
152 Axis[] result = new Axis[count]; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
153 |
1597
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
154 String ns = ArtifactNamespaceContext.NAMESPACE_URI; |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
155 |
1597
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
156 for (int i = 0; i < count; i++) { |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
157 Element node = (Element) axes.item(i); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
158 |
1597
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
159 String posStr = node.getAttributeNS(ns, "pos"); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
160 String fromStr = node.getAttributeNS(ns, "from"); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
161 String toStr = node.getAttributeNS(ns, "to"); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
162 String minStr = node.getAttributeNS(ns, "min"); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
163 String maxStr = node.getAttributeNS(ns, "max"); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
164 String axisType = node.getAttributeNS(ns, "axistype"); |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
165 |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
166 try { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
167 int pos = Integer.parseInt(posStr); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
168 |
556
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
169 if (pos >= result.length) { |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
170 // this should never happen |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
171 logger.debug("The axis is out of valid range: " + pos); |
556
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
172 continue; |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
173 } |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
174 |
1597
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
175 if (axisType != null && axisType.equals(DateAxis.TYPE)) { |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
176 long from = Long.parseLong(fromStr); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
177 long to = Long.parseLong(toStr); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
178 long min = Long.parseLong(minStr); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
179 long max = Long.parseLong(maxStr); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
180 |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
181 if (logger.isDebugEnabled()) { |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
182 logger.debug("date axis from: " + new Date(from)); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
183 logger.debug("date axis to : " + new Date(to)); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
184 logger.debug("date axis min : " + new Date(min)); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
185 logger.debug("date axis max : " + new Date(max)); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
186 } |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
187 |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
188 result[pos] = new DateAxis(pos, from, to, min, max); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
189 } |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
190 else { |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
191 double from = Double.parseDouble(fromStr); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
192 double to = Double.parseDouble(toStr); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
193 double min = Double.parseDouble(minStr); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
194 double max = Double.parseDouble(maxStr); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
195 |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
196 result[pos] = new NumberAxis(pos, from, to, min, max); |
8bbaa0d173cf
Save zoom parameters as Number; added new Axis types NumberAxis and DateAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1425
diff
changeset
|
197 } |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
198 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
199 catch (NumberFormatException nfe) { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
200 nfe.printStackTrace(); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
201 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
202 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
203 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
204 logger.debug("Parsed " + result.length + " axes"); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
205 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
206 return result; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
207 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
208 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
209 |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 /** |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 * Parses the chart info document and extract the Transform2D values. |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 * |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 * @param doc The chart info document. |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 * |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 * @return a Transform2D object to transfrom pixel coordinates into chart |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 * coordinates. |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 */ |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
218 protected Transform2D[] parseTransformationMatrix(Document doc) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
219 logger.debug("ChartInfoServiceImpl.parseTransformationMatrix"); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
221 NodeList matrix = (NodeList) XMLUtils.xpath( |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 doc, |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 XPATH_TRANSFORM_MATRIX, |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
224 XPathConstants.NODESET, |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 ArtifactNamespaceContext.INSTANCE); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
227 int num = matrix != null ? matrix.getLength() : 0; |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
228 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
229 List<Transform2D> transformer = new ArrayList<Transform2D>(num); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
230 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
231 for (int i = 0; i < num; i++) { |
1598
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
232 Transform2D t = createTransformer((Element) matrix.item(i)); |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
233 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
234 if (t == null) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
235 logger.warn("Broken transformation matrix at pos: " + i); |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
236 continue; |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
237 } |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
238 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
239 transformer.add(t); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
242 return (Transform2D[]) transformer.toArray(new Transform2D[num]); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
243 } |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
244 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
245 |
1598
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
246 protected Transform2D createTransformer(Element matrix) { |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
247 String ns = ArtifactNamespaceContext.NAMESPACE_URI; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 |
1598
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
249 String sx = matrix.getAttributeNS(ns, "sx"); |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
250 String sy = matrix.getAttributeNS(ns, "sy"); |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
251 String tx = matrix.getAttributeNS(ns, "tx"); |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
252 String ty = matrix.getAttributeNS(ns, "ty"); |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
253 String xType = matrix.getAttributeNS(ns, "xtype"); |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
254 String yType = matrix.getAttributeNS(ns, "ytype"); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 |
1598
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
256 xType = xType == null || xType.length() == 0 ? "number" : xType; |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
257 yType = yType == null || yType.length() == 0 ? "number" : yType; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
259 if (sx != null && sy != null && tx != null && ty != null) { |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 try { |
1598
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
261 logger.debug("Create new Transform2D with x format: " + xType); |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
262 logger.debug("Create new Transform2D with y format: " + yType); |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
263 |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
264 return new Transform2D( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 Double.parseDouble(sx), |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 Double.parseDouble(sy), |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 Double.parseDouble(tx), |
1598
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
268 Double.parseDouble(ty), |
ef745bc6bed9
Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1597
diff
changeset
|
269 xType, yType); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 catch (NumberFormatException nfe) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
272 logger.warn("Error while parsing matrix values."); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
273 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
275 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
561
diff
changeset
|
276 logger.warn("No matrix values found."); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 return new Transform2D(1d, 1d, 0d, 0d); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |