comparison flys-client/src/main/java/de/intevation/flys/client/server/ChartOutputServiceImpl.java @ 542:7c57149e8715

Append the x and y ranges determined after zooming with the ZoomboxControl to the attribute document used for the chart creation. flys-client/trunk@2045 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 03 Jun 2011 06:34:32 +0000
parents 8ea213bd8fba
children e74bf6bfeeb6
comparison
equal deleted inserted replaced
541:ed29599e06e5 542:7c57149e8715
80 ElementCreator ec = new ElementCreator( 80 ElementCreator ec = new ElementCreator(
81 doc, 81 doc,
82 ArtifactNamespaceContext.NAMESPACE_URI, 82 ArtifactNamespaceContext.NAMESPACE_URI,
83 ArtifactNamespaceContext.NAMESPACE_PREFIX); 83 ArtifactNamespaceContext.NAMESPACE_PREFIX);
84 84
85 appendChartSize(req, doc, ec); 85 Element attributes = ec.create("attributes");
86
87 appendChartSize(req, attributes, ec);
88 appendXRange(req, attributes, ec);
89 appendYRange(req, attributes, ec);
90
91 doc.appendChild(attributes);
86 92
87 return doc; 93 return doc;
88 } 94 }
89 95
90 96
92 * This method extracts the size (width/height) of a chart from request 98 * This method extracts the size (width/height) of a chart from request
93 * object and append those values - if they exist - to the attribute 99 * object and append those values - if they exist - to the attribute
94 * document used to adjust chart settings. 100 * document used to adjust chart settings.
95 * 101 *
96 * @param req The request object that might contain the chart size. 102 * @param req The request object that might contain the chart size.
97 * @param doc The attribute document used to adjust chart settings. 103 * @param attributes The attributes element used to adjust chart settings.
98 * @param ec The ElementCreator that might be used to create new Elements. 104 * @param ec The ElementCreator that might be used to create new Elements.
99 */ 105 */
100 protected void appendChartSize( 106 protected void appendChartSize(
101 HttpServletRequest req, 107 HttpServletRequest req,
102 Document doc, 108 Element attributes,
103 ElementCreator ec) 109 ElementCreator ec)
104 { 110 {
105 Element size = ec.create("size"); 111 Element size = ec.create("size");
106 112
107 String width = req.getParameter("width"); 113 String width = req.getParameter("width");
113 } 119 }
114 120
115 ec.addAttr(size, "width", width, true); 121 ec.addAttr(size, "width", width, true);
116 ec.addAttr(size, "height", height, true); 122 ec.addAttr(size, "height", height, true);
117 123
118 doc.appendChild(size); 124 attributes.appendChild(size);
125 }
126
127
128 /**
129 * This method extracts the x range for the chart from request object and
130 * appends those range - if it exists - to the attribute document used to
131 * adjust the chart settings.
132 *
133 * @param req The request object that might contain the chart size.
134 * @param doc The attribute document used to adjust chart settings.
135 * @param ec The ElementCreator that might be used to create new Elements.
136 */
137 protected void appendXRange(
138 HttpServletRequest req,
139 Element attributes,
140 ElementCreator ec)
141 {
142 Element range = ec.create("xrange");
143
144 String from = req.getParameter("minx");
145 String to = req.getParameter("maxx");
146
147 if (from != null && to != null) {
148 ec.addAttr(range, "from", from, true);
149 ec.addAttr(range, "to", to, true);
150
151 attributes.appendChild(range);
152 }
153 }
154
155
156 /**
157 * This method extracts the x range for the chart from request object and
158 * appends those range - if it exists - to the attribute document used to
159 * adjust the chart settings.
160 *
161 * @param req The request object that might contain the chart size.
162 * @param doc The attribute document used to adjust chart settings.
163 * @param ec The ElementCreator that might be used to create new Elements.
164 */
165 protected void appendYRange(
166 HttpServletRequest req,
167 Element attributes,
168 ElementCreator ec)
169 {
170 Element range = ec.create("yrange");
171
172 String from = req.getParameter("miny");
173 String to = req.getParameter("maxy");
174
175 if (from != null && to != null) {
176 ec.addAttr(range, "from", from, true);
177 ec.addAttr(range, "to", to, true);
178
179 attributes.appendChild(range);
180 }
119 } 181 }
120 } 182 }
121 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 183 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org