001: /*
002: * Copyright 2005 Joe Walker
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package jsx3.chart;
017:
018: import org.directwebremoting.ScriptBuffer;
019: import org.directwebremoting.proxy.ScriptProxy;
020: import org.directwebremoting.proxy.io.Context;
021:
022: /**
023: * A chart component that renders a grid of lines and fills aligned with an x and y axis.
024: * @author Joe Walker [joe at getahead dot org]
025: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
026: */
027: public class GridLines extends jsx3.chart.ChartComponent {
028: /**
029: * All reverse ajax proxies need context to work from
030: * @param scriptProxy The place we are writing scripts to
031: * @param context The script that got us to where we are now
032: */
033: public GridLines(Context context, String extension,
034: ScriptProxy scriptProxy) {
035: super (context, extension, scriptProxy);
036: }
037:
038: /**
039: * The instance initializer.
040: * @param name the GI name of the instance
041: * @param left left position (in pixels) of the object relative to its parent container
042: * @param top top position (in pixels) of the object relative to its parent container
043: * @param width width (in pixels) of the chart
044: * @param height height (in pixels) of the chart
045: */
046: public GridLines(String name, int left, int top, int width,
047: int height) {
048: super ((Context) null, (String) null, (ScriptProxy) null);
049: ScriptBuffer script = new ScriptBuffer();
050: script.appendCall("new GridLines", name, left, top, width,
051: height);
052: setInitScript(script);
053: }
054:
055: /**
056: * Returns the horizontalAbove field, whether to draw the horizontal lines and fills above the vertical ones.
057: * @param callback horizontalAbove
058: */
059: @SuppressWarnings("unchecked")
060: public void getHorizontalAbove(
061: org.directwebremoting.proxy.Callback<Boolean> callback) {
062: ScriptBuffer script = new ScriptBuffer();
063: String callbackPrefix = "";
064:
065: if (callback != null) {
066: callbackPrefix = "var reply = ";
067: }
068:
069: script.appendCall(callbackPrefix + getContextPath()
070: + "getHorizontalAbove");
071:
072: if (callback != null) {
073: String key = org.directwebremoting.extend.CallbackHelper
074: .saveCallback(callback, Boolean.class);
075: script
076: .appendCall("__System.activateCallback", key,
077: "reply");
078: }
079:
080: getScriptProxy().addScript(script);
081: }
082:
083: /**
084: * Sets the horizontalAbove field.
085: * @param horizontalAbove the new value for horizontalAbove
086: */
087: public void setHorizontalAbove(boolean horizontalAbove) {
088: ScriptBuffer script = new ScriptBuffer();
089: script.appendCall(getContextPath() + "setHorizontalAbove",
090: horizontalAbove);
091: getScriptProxy().addScript(script);
092: }
093:
094: /**
095: * Returns the inForeground field, whether to draw this legend on top of the data series (or below).
096: * @param callback inForeground
097: */
098: @SuppressWarnings("unchecked")
099: public void getInForeground(
100: org.directwebremoting.proxy.Callback<Boolean> callback) {
101: ScriptBuffer script = new ScriptBuffer();
102: String callbackPrefix = "";
103:
104: if (callback != null) {
105: callbackPrefix = "var reply = ";
106: }
107:
108: script.appendCall(callbackPrefix + getContextPath()
109: + "getInForeground");
110:
111: if (callback != null) {
112: String key = org.directwebremoting.extend.CallbackHelper
113: .saveCallback(callback, Boolean.class);
114: script
115: .appendCall("__System.activateCallback", key,
116: "reply");
117: }
118:
119: getScriptProxy().addScript(script);
120: }
121:
122: /**
123: * Sets the inForeground field.
124: * @param inForeground the new value for inForeground
125: */
126: public void setInForeground(boolean inForeground) {
127: ScriptBuffer script = new ScriptBuffer();
128: script.appendCall(getContextPath() + "setInForeground",
129: inForeground);
130: getScriptProxy().addScript(script);
131: }
132:
133: /**
134: * Returns the borderStroke field, string representation of the stroke used to outline the grid lines.
135: * @param callback borderStroke
136: */
137: @SuppressWarnings("unchecked")
138: public void getBorderStroke(
139: org.directwebremoting.proxy.Callback<String> callback) {
140: ScriptBuffer script = new ScriptBuffer();
141: String callbackPrefix = "";
142:
143: if (callback != null) {
144: callbackPrefix = "var reply = ";
145: }
146:
147: script.appendCall(callbackPrefix + getContextPath()
148: + "getBorderStroke");
149:
150: if (callback != null) {
151: String key = org.directwebremoting.extend.CallbackHelper
152: .saveCallback(callback, String.class);
153: script
154: .appendCall("__System.activateCallback", key,
155: "reply");
156: }
157:
158: getScriptProxy().addScript(script);
159: }
160:
161: /**
162: * Sets the borderStroke field.
163: * @param borderStroke the new value for borderStroke
164: */
165: public void setBorderStroke(String borderStroke) {
166: ScriptBuffer script = new ScriptBuffer();
167: script.appendCall(getContextPath() + "setBorderStroke",
168: borderStroke);
169: getScriptProxy().addScript(script);
170: }
171:
172: /**
173: * Returns the fillV field, array of string representations of vector fills used to fill in areas between vertical major ticks; if the length of the array is greater than one, the areas alternate through the list of fills.
174: * @param callback fillV
175: */
176: @SuppressWarnings("unchecked")
177: public void getFillV(
178: org.directwebremoting.proxy.Callback<Object[]> callback) {
179: ScriptBuffer script = new ScriptBuffer();
180: String callbackPrefix = "";
181:
182: if (callback != null) {
183: callbackPrefix = "var reply = ";
184: }
185:
186: script.appendCall(callbackPrefix + getContextPath()
187: + "getFillV");
188:
189: if (callback != null) {
190: String key = org.directwebremoting.extend.CallbackHelper
191: .saveCallback(callback, Object[].class);
192: script
193: .appendCall("__System.activateCallback", key,
194: "reply");
195: }
196:
197: getScriptProxy().addScript(script);
198: }
199:
200: /**
201: * Sets the fillV field.
202: * @param fillV the new value for fillV
203: */
204: public void setFillV(Object[] fillV) {
205: ScriptBuffer script = new ScriptBuffer();
206: script.appendCall(getContextPath() + "setFillV", fillV);
207: getScriptProxy().addScript(script);
208: }
209:
210: /**
211: * Returns the strokeMajorV field, array of string representations of VectorStroke's used to draw the vertical major ticks; if the length of the array is greater than one, the ticks alternate through the list of strokes.
212: * @param callback strokeMajorV
213: */
214: @SuppressWarnings("unchecked")
215: public void getStrokeMajorV(
216: org.directwebremoting.proxy.Callback<Object[]> callback) {
217: ScriptBuffer script = new ScriptBuffer();
218: String callbackPrefix = "";
219:
220: if (callback != null) {
221: callbackPrefix = "var reply = ";
222: }
223:
224: script.appendCall(callbackPrefix + getContextPath()
225: + "getStrokeMajorV");
226:
227: if (callback != null) {
228: String key = org.directwebremoting.extend.CallbackHelper
229: .saveCallback(callback, Object[].class);
230: script
231: .appendCall("__System.activateCallback", key,
232: "reply");
233: }
234:
235: getScriptProxy().addScript(script);
236: }
237:
238: /**
239: * Sets the strokeMajorV field.
240: * @param strokeMajorV the new value for strokeMajorV
241: */
242: public void setStrokeMajorV(Object[] strokeMajorV) {
243: ScriptBuffer script = new ScriptBuffer();
244: script.appendCall(getContextPath() + "setStrokeMajorV",
245: strokeMajorV);
246: getScriptProxy().addScript(script);
247: }
248:
249: /**
250: * Returns the strokeMinorV field, array of string representations of VectorStroke's used to draw the vertical minor ticks; if the length of the array is greater than one, the ticks alternate through the list of strokes.
251: * @param callback strokeMinorV
252: */
253: @SuppressWarnings("unchecked")
254: public void getStrokeMinorV(
255: org.directwebremoting.proxy.Callback<Object[]> callback) {
256: ScriptBuffer script = new ScriptBuffer();
257: String callbackPrefix = "";
258:
259: if (callback != null) {
260: callbackPrefix = "var reply = ";
261: }
262:
263: script.appendCall(callbackPrefix + getContextPath()
264: + "getStrokeMinorV");
265:
266: if (callback != null) {
267: String key = org.directwebremoting.extend.CallbackHelper
268: .saveCallback(callback, Object[].class);
269: script
270: .appendCall("__System.activateCallback", key,
271: "reply");
272: }
273:
274: getScriptProxy().addScript(script);
275: }
276:
277: /**
278: * Sets the strokeMinorV field.
279: * @param strokeMinorV the new value for strokeMinorV
280: */
281: public void setStrokeMinorV(Object[] strokeMinorV) {
282: ScriptBuffer script = new ScriptBuffer();
283: script.appendCall(getContextPath() + "setStrokeMinorV",
284: strokeMinorV);
285: getScriptProxy().addScript(script);
286: }
287:
288: /**
289: * Returns the fillH field, array of string representations of vector fills used to fill in areas between horizontal major ticks; if the length of the array is greater than one, the areas alternate through the list of fills.
290: * @param callback fillH
291: */
292: @SuppressWarnings("unchecked")
293: public void getFillH(
294: org.directwebremoting.proxy.Callback<Object[]> callback) {
295: ScriptBuffer script = new ScriptBuffer();
296: String callbackPrefix = "";
297:
298: if (callback != null) {
299: callbackPrefix = "var reply = ";
300: }
301:
302: script.appendCall(callbackPrefix + getContextPath()
303: + "getFillH");
304:
305: if (callback != null) {
306: String key = org.directwebremoting.extend.CallbackHelper
307: .saveCallback(callback, Object[].class);
308: script
309: .appendCall("__System.activateCallback", key,
310: "reply");
311: }
312:
313: getScriptProxy().addScript(script);
314: }
315:
316: /**
317: * Sets the fillH field.
318: * @param fillH the new value for fillH
319: */
320: public void setFillH(Object[] fillH) {
321: ScriptBuffer script = new ScriptBuffer();
322: script.appendCall(getContextPath() + "setFillH", fillH);
323: getScriptProxy().addScript(script);
324: }
325:
326: /**
327: * Returns the strokeMajorH field, array of string representations of VectorStroke's used to draw the horizontal major ticks; if the length of the array is greater than one, the ticks alternate through the list of strokes.
328: * @param callback strokeMajorH
329: */
330: @SuppressWarnings("unchecked")
331: public void getStrokeMajorH(
332: org.directwebremoting.proxy.Callback<Object[]> callback) {
333: ScriptBuffer script = new ScriptBuffer();
334: String callbackPrefix = "";
335:
336: if (callback != null) {
337: callbackPrefix = "var reply = ";
338: }
339:
340: script.appendCall(callbackPrefix + getContextPath()
341: + "getStrokeMajorH");
342:
343: if (callback != null) {
344: String key = org.directwebremoting.extend.CallbackHelper
345: .saveCallback(callback, Object[].class);
346: script
347: .appendCall("__System.activateCallback", key,
348: "reply");
349: }
350:
351: getScriptProxy().addScript(script);
352: }
353:
354: /**
355: * Sets the strokeMajorH field.
356: * @param strokeMajorH the new value for strokeMajorH
357: */
358: public void setStrokeMajorH(Object[] strokeMajorH) {
359: ScriptBuffer script = new ScriptBuffer();
360: script.appendCall(getContextPath() + "setStrokeMajorH",
361: strokeMajorH);
362: getScriptProxy().addScript(script);
363: }
364:
365: /**
366: * Returns the strokeMinorH field, array of string representations of VectorStroke's used to draw the horizontal minor ticks; if the length of the array is greater than one, the ticks alternate through the list of strokes.
367: * @param callback strokeMinorH
368: */
369: @SuppressWarnings("unchecked")
370: public void getStrokeMinorH(
371: org.directwebremoting.proxy.Callback<Object[]> callback) {
372: ScriptBuffer script = new ScriptBuffer();
373: String callbackPrefix = "";
374:
375: if (callback != null) {
376: callbackPrefix = "var reply = ";
377: }
378:
379: script.appendCall(callbackPrefix + getContextPath()
380: + "getStrokeMinorH");
381:
382: if (callback != null) {
383: String key = org.directwebremoting.extend.CallbackHelper
384: .saveCallback(callback, Object[].class);
385: script
386: .appendCall("__System.activateCallback", key,
387: "reply");
388: }
389:
390: getScriptProxy().addScript(script);
391: }
392:
393: /**
394: * Sets the strokeMinorH field.
395: * @param strokeMinorH the new value for strokeMinorH
396: */
397: public void setStrokeMinorH(Object[] strokeMinorH) {
398: ScriptBuffer script = new ScriptBuffer();
399: script.appendCall(getContextPath() + "setStrokeMinorH",
400: strokeMinorH);
401: getScriptProxy().addScript(script);
402: }
403:
404: /**
405: * Returns the x (horizontal) axis used to determine where to draw tick lines.
406: */
407: @SuppressWarnings("unchecked")
408: public jsx3.chart.Axis getXAxis() {
409: String extension = "getXAxis().";
410: try {
411: java.lang.reflect.Constructor<jsx3.chart.Axis> ctor = jsx3.chart.Axis.class
412: .getConstructor(Context.class, String.class,
413: ScriptProxy.class);
414: return ctor.newInstance(this , extension, getScriptProxy());
415: } catch (Exception ex) {
416: throw new IllegalArgumentException("Unsupported type: "
417: + jsx3.chart.Axis.class.getName());
418: }
419: }
420:
421: /**
422: * Returns the x (horizontal) axis used to determine where to draw tick lines.
423: * @param returnType The expected return type
424: */
425: @SuppressWarnings("unchecked")
426: public <T> T getXAxis(Class<T> returnType) {
427: String extension = "getXAxis().";
428: try {
429: java.lang.reflect.Constructor<T> ctor = returnType
430: .getConstructor(Context.class, String.class,
431: ScriptProxy.class);
432: return ctor.newInstance(this , extension, getScriptProxy());
433: } catch (Exception ex) {
434: throw new IllegalArgumentException(
435: "Unsupported return type: " + returnType.getName());
436: }
437: }
438:
439: /**
440: * Returns the y (vertical) axis used to determine where to draw tick lines.
441: */
442: @SuppressWarnings("unchecked")
443: public jsx3.chart.Axis getYAxis() {
444: String extension = "getYAxis().";
445: try {
446: java.lang.reflect.Constructor<jsx3.chart.Axis> ctor = jsx3.chart.Axis.class
447: .getConstructor(Context.class, String.class,
448: ScriptProxy.class);
449: return ctor.newInstance(this , extension, getScriptProxy());
450: } catch (Exception ex) {
451: throw new IllegalArgumentException("Unsupported type: "
452: + jsx3.chart.Axis.class.getName());
453: }
454: }
455:
456: /**
457: * Returns the y (vertical) axis used to determine where to draw tick lines.
458: * @param returnType The expected return type
459: */
460: @SuppressWarnings("unchecked")
461: public <T> T getYAxis(Class<T> returnType) {
462: String extension = "getYAxis().";
463: try {
464: java.lang.reflect.Constructor<T> ctor = returnType
465: .getConstructor(Context.class, String.class,
466: ScriptProxy.class);
467: return ctor.newInstance(this , extension, getScriptProxy());
468: } catch (Exception ex) {
469: throw new IllegalArgumentException(
470: "Unsupported return type: " + returnType.getName());
471: }
472: }
473:
474: }
|