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 base class for all types of axis. Provides all the common properties as well as all rendering
024: logic. Rendering relies on template methods implemented in concrete subclasses.
025:
026: An axis renders in the following location based on its horizontal and primary properties:
027:
028: horizontal x primary -> bottom
029: vertical x primary -> left
030: horizontal x secondary -> top
031: vertical x secondary -> right
032: * @author Joe Walker [joe at getahead dot org]
033: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
034: */
035: public class Axis extends jsx3.chart.ChartComponent {
036: /**
037: * All reverse ajax proxies need context to work from
038: * @param scriptProxy The place we are writing scripts to
039: * @param context The script that got us to where we are now
040: */
041: public Axis(Context context, String extension,
042: ScriptProxy scriptProxy) {
043: super (context, extension, scriptProxy);
044: }
045:
046: /**
047: * The instance initializer.
048: * @param name the GI name of the instance
049: * @param horizontal whether this axis is horizontal (x), otherwise it's vertical (y)
050: * @param primary whether this axis is primary, otherwise it's secondary
051: */
052: public Axis(String name, boolean horizontal, boolean primary) {
053: super ((Context) null, (String) null, (ScriptProxy) null);
054: ScriptBuffer script = new ScriptBuffer();
055: script.appendCall("new Axis", name, horizontal, primary);
056: setInitScript(script);
057: }
058:
059: /**
060: *
061: */
062: public static final String TICK_INSIDE = "inside";
063:
064: /**
065: *
066: */
067: public static final String TICK_OUTSIDE = "outside";
068:
069: /**
070: *
071: */
072: public static final String TICK_CROSS = "cross";
073:
074: /**
075: *
076: */
077: public static final String TICK_NONE = "none";
078:
079: /**
080: *
081: */
082: public static final String LABEL_HIGH = "high";
083:
084: /**
085: *
086: */
087: public static final String LABEL_LOW = "low";
088:
089: /**
090: *
091: */
092: public static final String LABEL_AXIS = "axis";
093:
094: /**
095: * formats labels as a percent, ie "50%"
096: * @param v
097: */
098: @SuppressWarnings("unchecked")
099: public void percent(Integer v,
100: org.directwebremoting.proxy.Callback<String> callback) {
101: ScriptBuffer script = new ScriptBuffer();
102: String callbackPrefix = "";
103:
104: if (callback != null) {
105: callbackPrefix = "var reply = ";
106: }
107:
108: script.appendCall(
109: callbackPrefix + getContextPath() + "percent", v);
110:
111: if (callback != null) {
112: String key = org.directwebremoting.extend.CallbackHelper
113: .saveCallback(callback, String.class);
114: script
115: .appendCall("__System.activateCallback", key,
116: "reply");
117: }
118:
119: getScriptProxy().addScript(script);
120: }
121:
122: /**
123: * formats labels in scientific notation, ie "5e2"
124: * @param v
125: * @param signif
126: */
127: @SuppressWarnings("unchecked")
128: public void scientific(Integer v, int signif,
129: org.directwebremoting.proxy.Callback<String> callback) {
130: ScriptBuffer script = new ScriptBuffer();
131: String callbackPrefix = "";
132:
133: if (callback != null) {
134: callbackPrefix = "var reply = ";
135: }
136:
137: script.appendCall(callbackPrefix + getContextPath()
138: + "scientific", v, signif);
139:
140: if (callback != null) {
141: String key = org.directwebremoting.extend.CallbackHelper
142: .saveCallback(callback, String.class);
143: script
144: .appendCall("__System.activateCallback", key,
145: "reply");
146: }
147:
148: getScriptProxy().addScript(script);
149: }
150:
151: /**
152: * Returns the horizontal field, whether this is an x axis, otherwise it is a y axis.
153: * @param callback horizontal
154: */
155: @SuppressWarnings("unchecked")
156: public void getHorizontal(
157: org.directwebremoting.proxy.Callback<Boolean> callback) {
158: ScriptBuffer script = new ScriptBuffer();
159: String callbackPrefix = "";
160:
161: if (callback != null) {
162: callbackPrefix = "var reply = ";
163: }
164:
165: script.appendCall(callbackPrefix + getContextPath()
166: + "getHorizontal");
167:
168: if (callback != null) {
169: String key = org.directwebremoting.extend.CallbackHelper
170: .saveCallback(callback, Boolean.class);
171: script
172: .appendCall("__System.activateCallback", key,
173: "reply");
174: }
175:
176: getScriptProxy().addScript(script);
177: }
178:
179: /**
180: * Sets the horizontal field.
181: * @param horizontal the new value for horizontal
182: */
183: public void setHorizontal(boolean horizontal) {
184: ScriptBuffer script = new ScriptBuffer();
185: script.appendCall(getContextPath() + "setHorizontal",
186: horizontal);
187: getScriptProxy().addScript(script);
188: }
189:
190: /**
191: * Returns the showAxis field, whether to show the line along the axis.
192: * @param callback showAxis
193: */
194: @SuppressWarnings("unchecked")
195: public void getShowAxis(
196: org.directwebremoting.proxy.Callback<Boolean> callback) {
197: ScriptBuffer script = new ScriptBuffer();
198: String callbackPrefix = "";
199:
200: if (callback != null) {
201: callbackPrefix = "var reply = ";
202: }
203:
204: script.appendCall(callbackPrefix + getContextPath()
205: + "getShowAxis");
206:
207: if (callback != null) {
208: String key = org.directwebremoting.extend.CallbackHelper
209: .saveCallback(callback, Boolean.class);
210: script
211: .appendCall("__System.activateCallback", key,
212: "reply");
213: }
214:
215: getScriptProxy().addScript(script);
216: }
217:
218: /**
219: * Sets the showAxis field.
220: * @param showAxis the new value for showAxis
221: */
222: public void setShowAxis(boolean showAxis) {
223: ScriptBuffer script = new ScriptBuffer();
224: script.appendCall(getContextPath() + "setShowAxis", showAxis);
225: getScriptProxy().addScript(script);
226: }
227:
228: /**
229: * Returns the labelFunction field.
230: * @param callback labelFunction
231: */
232: @SuppressWarnings("unchecked")
233: public void getLabelFunction(
234: org.directwebremoting.proxy.Callback<org.directwebremoting.proxy.CodeBlock> callback) {
235: ScriptBuffer script = new ScriptBuffer();
236: String callbackPrefix = "";
237:
238: if (callback != null) {
239: callbackPrefix = "var reply = ";
240: }
241:
242: script.appendCall(callbackPrefix + getContextPath()
243: + "getLabelFunction");
244:
245: if (callback != null) {
246: String key = org.directwebremoting.extend.CallbackHelper
247: .saveCallback(callback,
248: org.directwebremoting.proxy.CodeBlock.class);
249: script
250: .appendCall("__System.activateCallback", key,
251: "reply");
252: }
253:
254: getScriptProxy().addScript(script);
255: }
256:
257: /**
258: * Sets the labelFunction field, allows for formatting and transformation of a major tick label; should eval to a function with the signature function(object) : string.
259: * @param labelFunction the new value for labelFunction
260: */
261: public void setLabelFunction(String labelFunction) {
262: ScriptBuffer script = new ScriptBuffer();
263: script.appendCall(getContextPath() + "setLabelFunction",
264: labelFunction);
265: getScriptProxy().addScript(script);
266: }
267:
268: /**
269: * Returns the axisStroke field, string representation of the VectorStroke used to draw the line of the axis.
270: * @param callback axisStroke
271: */
272: @SuppressWarnings("unchecked")
273: public void getAxisStroke(
274: org.directwebremoting.proxy.Callback<String> callback) {
275: ScriptBuffer script = new ScriptBuffer();
276: String callbackPrefix = "";
277:
278: if (callback != null) {
279: callbackPrefix = "var reply = ";
280: }
281:
282: script.appendCall(callbackPrefix + getContextPath()
283: + "getAxisStroke");
284:
285: if (callback != null) {
286: String key = org.directwebremoting.extend.CallbackHelper
287: .saveCallback(callback, String.class);
288: script
289: .appendCall("__System.activateCallback", key,
290: "reply");
291: }
292:
293: getScriptProxy().addScript(script);
294: }
295:
296: /**
297: * Sets the axisStroke field.
298: * @param axisStroke the new value for axisStroke
299: */
300: public void setAxisStroke(String axisStroke) {
301: ScriptBuffer script = new ScriptBuffer();
302: script.appendCall(getContextPath() + "setAxisStroke",
303: axisStroke);
304: getScriptProxy().addScript(script);
305: }
306:
307: /**
308: * Returns the showLabels field, whether to show major tick labels.
309: * @param callback showLabels
310: */
311: @SuppressWarnings("unchecked")
312: public void getShowLabels(
313: org.directwebremoting.proxy.Callback<Boolean> callback) {
314: ScriptBuffer script = new ScriptBuffer();
315: String callbackPrefix = "";
316:
317: if (callback != null) {
318: callbackPrefix = "var reply = ";
319: }
320:
321: script.appendCall(callbackPrefix + getContextPath()
322: + "getShowLabels");
323:
324: if (callback != null) {
325: String key = org.directwebremoting.extend.CallbackHelper
326: .saveCallback(callback, Boolean.class);
327: script
328: .appendCall("__System.activateCallback", key,
329: "reply");
330: }
331:
332: getScriptProxy().addScript(script);
333: }
334:
335: /**
336: * Sets the showLabels field.
337: * @param showLabels the new value for showLabels
338: */
339: public void setShowLabels(boolean showLabels) {
340: ScriptBuffer script = new ScriptBuffer();
341: script.appendCall(getContextPath() + "setShowLabels",
342: showLabels);
343: getScriptProxy().addScript(script);
344: }
345:
346: /**
347: * Returns the labelGap field, the pixel gap between the tick lines and the labels.
348: * @param callback labelGap
349: */
350: @SuppressWarnings("unchecked")
351: public void getLabelGap(
352: org.directwebremoting.proxy.Callback<Integer> callback) {
353: ScriptBuffer script = new ScriptBuffer();
354: String callbackPrefix = "";
355:
356: if (callback != null) {
357: callbackPrefix = "var reply = ";
358: }
359:
360: script.appendCall(callbackPrefix + getContextPath()
361: + "getLabelGap");
362:
363: if (callback != null) {
364: String key = org.directwebremoting.extend.CallbackHelper
365: .saveCallback(callback, Integer.class);
366: script
367: .appendCall("__System.activateCallback", key,
368: "reply");
369: }
370:
371: getScriptProxy().addScript(script);
372: }
373:
374: /**
375: * Sets the labelGap field.
376: * @param labelGap the new value for labelGap
377: */
378: public void setLabelGap(int labelGap) {
379: ScriptBuffer script = new ScriptBuffer();
380: script.appendCall(getContextPath() + "setLabelGap", labelGap);
381: getScriptProxy().addScript(script);
382: }
383:
384: /**
385: * Sets the labelPlacement field, checks for invalid values.
386: * @param labelPlacement the new value for labelPlacement, one of {'axis','high','low'}
387: */
388: public void setLabelPlacement(String labelPlacement) {
389: ScriptBuffer script = new ScriptBuffer();
390: script.appendCall(getContextPath() + "setLabelPlacement",
391: labelPlacement);
392: getScriptProxy().addScript(script);
393: }
394:
395: /**
396: * Returns the tickLength field, the length in pixels of the major tick (if tickPlacement is "cross" the length will actually be twice this.
397: * @param callback tickLength
398: */
399: @SuppressWarnings("unchecked")
400: public void getTickLength(
401: org.directwebremoting.proxy.Callback<Integer> callback) {
402: ScriptBuffer script = new ScriptBuffer();
403: String callbackPrefix = "";
404:
405: if (callback != null) {
406: callbackPrefix = "var reply = ";
407: }
408:
409: script.appendCall(callbackPrefix + getContextPath()
410: + "getTickLength");
411:
412: if (callback != null) {
413: String key = org.directwebremoting.extend.CallbackHelper
414: .saveCallback(callback, Integer.class);
415: script
416: .appendCall("__System.activateCallback", key,
417: "reply");
418: }
419:
420: getScriptProxy().addScript(script);
421: }
422:
423: /**
424: * Sets the tickLength field.
425: * @param tickLength the new value for tickLength
426: */
427: public void setTickLength(int tickLength) {
428: ScriptBuffer script = new ScriptBuffer();
429: script.appendCall(getContextPath() + "setTickLength",
430: tickLength);
431: getScriptProxy().addScript(script);
432: }
433:
434: /**
435: * Returns the tickPlacement field, where to place the major ticks.
436: * @param callback tickPlacement, one of {'none','inside','outside','cross'}
437: */
438: @SuppressWarnings("unchecked")
439: public void getTickPlacement(
440: org.directwebremoting.proxy.Callback<String> callback) {
441: ScriptBuffer script = new ScriptBuffer();
442: String callbackPrefix = "";
443:
444: if (callback != null) {
445: callbackPrefix = "var reply = ";
446: }
447:
448: script.appendCall(callbackPrefix + getContextPath()
449: + "getTickPlacement");
450:
451: if (callback != null) {
452: String key = org.directwebremoting.extend.CallbackHelper
453: .saveCallback(callback, String.class);
454: script
455: .appendCall("__System.activateCallback", key,
456: "reply");
457: }
458:
459: getScriptProxy().addScript(script);
460: }
461:
462: /**
463: * Sets the tickPlacement field.
464: * @param tickPlacement the new value for tickPlacement, one of {'none','inside','outside','cross'}
465: */
466: public void setTickPlacement(String tickPlacement) {
467: ScriptBuffer script = new ScriptBuffer();
468: script.appendCall(getContextPath() + "setTickPlacement",
469: tickPlacement);
470: getScriptProxy().addScript(script);
471: }
472:
473: /**
474: * Returns the tickStroke field, string representation of VectorStroke used to draw major ticks.
475: * @param callback tickStroke
476: */
477: @SuppressWarnings("unchecked")
478: public void getTickStroke(
479: org.directwebremoting.proxy.Callback<String> callback) {
480: ScriptBuffer script = new ScriptBuffer();
481: String callbackPrefix = "";
482:
483: if (callback != null) {
484: callbackPrefix = "var reply = ";
485: }
486:
487: script.appendCall(callbackPrefix + getContextPath()
488: + "getTickStroke");
489:
490: if (callback != null) {
491: String key = org.directwebremoting.extend.CallbackHelper
492: .saveCallback(callback, String.class);
493: script
494: .appendCall("__System.activateCallback", key,
495: "reply");
496: }
497:
498: getScriptProxy().addScript(script);
499: }
500:
501: /**
502: * Sets the tickStroke field.
503: * @param tickStroke the new value for tickStroke
504: */
505: public void setTickStroke(String tickStroke) {
506: ScriptBuffer script = new ScriptBuffer();
507: script.appendCall(getContextPath() + "setTickStroke",
508: tickStroke);
509: getScriptProxy().addScript(script);
510: }
511:
512: /**
513: * Returns the minorTickDivisions field, number of minor tick divisions between major ticks; the number of minor ticks drawn will be this number minus 1.
514: * @param callback minorTickDivisions
515: */
516: @SuppressWarnings("unchecked")
517: public void getMinorTickDivisions(
518: org.directwebremoting.proxy.Callback<Integer> callback) {
519: ScriptBuffer script = new ScriptBuffer();
520: String callbackPrefix = "";
521:
522: if (callback != null) {
523: callbackPrefix = "var reply = ";
524: }
525:
526: script.appendCall(callbackPrefix + getContextPath()
527: + "getMinorTickDivisions");
528:
529: if (callback != null) {
530: String key = org.directwebremoting.extend.CallbackHelper
531: .saveCallback(callback, Integer.class);
532: script
533: .appendCall("__System.activateCallback", key,
534: "reply");
535: }
536:
537: getScriptProxy().addScript(script);
538: }
539:
540: /**
541: * Sets the minorTickDivisions field.
542: * @param minorTickDivisions the new value for minorTickDivisions
543: */
544: public void setMinorTickDivisions(int minorTickDivisions) {
545: ScriptBuffer script = new ScriptBuffer();
546: script.appendCall(getContextPath() + "setMinorTickDivisions",
547: minorTickDivisions);
548: getScriptProxy().addScript(script);
549: }
550:
551: /**
552: * Returns the minorTickLength field, the length in pixels of the minor tick (if tickPlacement is "cross" the length will actually be twice this.
553: * @param callback minorTickLength
554: */
555: @SuppressWarnings("unchecked")
556: public void getMinorTickLength(
557: org.directwebremoting.proxy.Callback<Integer> callback) {
558: ScriptBuffer script = new ScriptBuffer();
559: String callbackPrefix = "";
560:
561: if (callback != null) {
562: callbackPrefix = "var reply = ";
563: }
564:
565: script.appendCall(callbackPrefix + getContextPath()
566: + "getMinorTickLength");
567:
568: if (callback != null) {
569: String key = org.directwebremoting.extend.CallbackHelper
570: .saveCallback(callback, Integer.class);
571: script
572: .appendCall("__System.activateCallback", key,
573: "reply");
574: }
575:
576: getScriptProxy().addScript(script);
577: }
578:
579: /**
580: * Sets the minorTickLength field.
581: * @param minorTickLength the new value for minorTickLength
582: */
583: public void setMinorTickLength(int minorTickLength) {
584: ScriptBuffer script = new ScriptBuffer();
585: script.appendCall(getContextPath() + "setMinorTickLength",
586: minorTickLength);
587: getScriptProxy().addScript(script);
588: }
589:
590: /**
591: * Returns the minorTickPlacement field, where to place the minor ticks.
592: * @param callback minorTickPlacement, one of {'none','inside','outside','cross'}
593: */
594: @SuppressWarnings("unchecked")
595: public void getMinorTickPlacement(
596: org.directwebremoting.proxy.Callback<String> callback) {
597: ScriptBuffer script = new ScriptBuffer();
598: String callbackPrefix = "";
599:
600: if (callback != null) {
601: callbackPrefix = "var reply = ";
602: }
603:
604: script.appendCall(callbackPrefix + getContextPath()
605: + "getMinorTickPlacement");
606:
607: if (callback != null) {
608: String key = org.directwebremoting.extend.CallbackHelper
609: .saveCallback(callback, String.class);
610: script
611: .appendCall("__System.activateCallback", key,
612: "reply");
613: }
614:
615: getScriptProxy().addScript(script);
616: }
617:
618: /**
619: * Sets the minorTickPlacement field.
620: * @param minorTickPlacement the new value for minorTickPlacement, one of {'none','inside','outside','cross'}
621: */
622: public void setMinorTickPlacement(String minorTickPlacement) {
623: ScriptBuffer script = new ScriptBuffer();
624: script.appendCall(getContextPath() + "setMinorTickPlacement",
625: minorTickPlacement);
626: getScriptProxy().addScript(script);
627: }
628:
629: /**
630: * Returns the minorTickStroke field, string representation of VectorStroke used to draw minor ticks.
631: * @param callback minorTickStroke
632: */
633: @SuppressWarnings("unchecked")
634: public void getMinorTickStroke(
635: org.directwebremoting.proxy.Callback<String> callback) {
636: ScriptBuffer script = new ScriptBuffer();
637: String callbackPrefix = "";
638:
639: if (callback != null) {
640: callbackPrefix = "var reply = ";
641: }
642:
643: script.appendCall(callbackPrefix + getContextPath()
644: + "getMinorTickStroke");
645:
646: if (callback != null) {
647: String key = org.directwebremoting.extend.CallbackHelper
648: .saveCallback(callback, String.class);
649: script
650: .appendCall("__System.activateCallback", key,
651: "reply");
652: }
653:
654: getScriptProxy().addScript(script);
655: }
656:
657: /**
658: * Sets the minorTickStroke field.
659: * @param minorTickStroke the new value for minorTickStroke
660: */
661: public void setMinorTickStroke(String minorTickStroke) {
662: ScriptBuffer script = new ScriptBuffer();
663: script.appendCall(getContextPath() + "setMinorTickStroke",
664: minorTickStroke);
665: getScriptProxy().addScript(script);
666: }
667:
668: /**
669: * Returns the labelClass field, the CSS class used to render major tick labels.
670: * @param callback labelClass
671: */
672: @SuppressWarnings("unchecked")
673: public void getLabelClass(
674: org.directwebremoting.proxy.Callback<String> callback) {
675: ScriptBuffer script = new ScriptBuffer();
676: String callbackPrefix = "";
677:
678: if (callback != null) {
679: callbackPrefix = "var reply = ";
680: }
681:
682: script.appendCall(callbackPrefix + getContextPath()
683: + "getLabelClass");
684:
685: if (callback != null) {
686: String key = org.directwebremoting.extend.CallbackHelper
687: .saveCallback(callback, String.class);
688: script
689: .appendCall("__System.activateCallback", key,
690: "reply");
691: }
692:
693: getScriptProxy().addScript(script);
694: }
695:
696: /**
697: * Sets the labelClass field.
698: * @param labelClass the new value for labelClass
699: */
700: public void setLabelClass(String labelClass) {
701: ScriptBuffer script = new ScriptBuffer();
702: script.appendCall(getContextPath() + "setLabelClass",
703: labelClass);
704: getScriptProxy().addScript(script);
705: }
706:
707: /**
708: * Returns the labelStyle field, the CSS style attribute used to render major tick labels.
709: * @param callback labelStyle
710: */
711: @SuppressWarnings("unchecked")
712: public void getLabelStyle(
713: org.directwebremoting.proxy.Callback<String> callback) {
714: ScriptBuffer script = new ScriptBuffer();
715: String callbackPrefix = "";
716:
717: if (callback != null) {
718: callbackPrefix = "var reply = ";
719: }
720:
721: script.appendCall(callbackPrefix + getContextPath()
722: + "getLabelStyle");
723:
724: if (callback != null) {
725: String key = org.directwebremoting.extend.CallbackHelper
726: .saveCallback(callback, String.class);
727: script
728: .appendCall("__System.activateCallback", key,
729: "reply");
730: }
731:
732: getScriptProxy().addScript(script);
733: }
734:
735: /**
736: * Sets the labelStyle field.
737: * @param labelStyle the new value for labelStyle
738: */
739: public void setLabelStyle(String labelStyle) {
740: ScriptBuffer script = new ScriptBuffer();
741: script.appendCall(getContextPath() + "setLabelStyle",
742: labelStyle);
743: getScriptProxy().addScript(script);
744: }
745:
746: /**
747: * Returns the labelColor field, the RGB color value of the label font; note that this is the only way to set the color of the text, using a CSS style attribute will have no effect.
748: * @param callback labelColor
749: */
750: @SuppressWarnings("unchecked")
751: public void getLabelColor(
752: org.directwebremoting.proxy.Callback<String> callback) {
753: ScriptBuffer script = new ScriptBuffer();
754: String callbackPrefix = "";
755:
756: if (callback != null) {
757: callbackPrefix = "var reply = ";
758: }
759:
760: script.appendCall(callbackPrefix + getContextPath()
761: + "getLabelColor");
762:
763: if (callback != null) {
764: String key = org.directwebremoting.extend.CallbackHelper
765: .saveCallback(callback, String.class);
766: script
767: .appendCall("__System.activateCallback", key,
768: "reply");
769: }
770:
771: getScriptProxy().addScript(script);
772: }
773:
774: /**
775: * Sets the labelColor field.
776: * @param labelColor the new value for labelColor
777: */
778: public void setLabelColor(Integer labelColor) {
779: ScriptBuffer script = new ScriptBuffer();
780: script.appendCall(getContextPath() + "setLabelColor",
781: labelColor);
782: getScriptProxy().addScript(script);
783: }
784:
785: /**
786: * Sets the labelColor field.
787: * @param labelColor the new value for labelColor
788: */
789: public void setLabelColor(String labelColor) {
790: ScriptBuffer script = new ScriptBuffer();
791: script.appendCall(getContextPath() + "setLabelColor",
792: labelColor);
793: getScriptProxy().addScript(script);
794: }
795:
796: /**
797: * Returns the display width, the maximum amount of space perpendicular to the axis and outside of the data area that the ticks and labels may occupy (doesn't include area given to axis title).
798: * @param callback displayWidth
799: */
800: @SuppressWarnings("unchecked")
801: public void getDisplayWidth(
802: org.directwebremoting.proxy.Callback<Integer> callback) {
803: ScriptBuffer script = new ScriptBuffer();
804: String callbackPrefix = "";
805:
806: if (callback != null) {
807: callbackPrefix = "var reply = ";
808: }
809:
810: script.appendCall(callbackPrefix + getContextPath()
811: + "getDisplayWidth");
812:
813: if (callback != null) {
814: String key = org.directwebremoting.extend.CallbackHelper
815: .saveCallback(callback, Integer.class);
816: script
817: .appendCall("__System.activateCallback", key,
818: "reply");
819: }
820:
821: getScriptProxy().addScript(script);
822: }
823:
824: /**
825: * Sets the displayWidth field.
826: * @param displayWidth the new value for displayWidth
827: */
828: public void setDisplayWidth(int displayWidth) {
829: ScriptBuffer script = new ScriptBuffer();
830: script.appendCall(getContextPath() + "setDisplayWidth",
831: displayWidth);
832: getScriptProxy().addScript(script);
833: }
834:
835: /**
836: * Returns the optional jsx3.chart.ChartLabel child.
837: */
838: @SuppressWarnings("unchecked")
839: public jsx3.chart.ChartLabel getAxisTitle() {
840: String extension = "getAxisTitle().";
841: try {
842: java.lang.reflect.Constructor<jsx3.chart.ChartLabel> ctor = jsx3.chart.ChartLabel.class
843: .getConstructor(Context.class, String.class,
844: ScriptProxy.class);
845: return ctor.newInstance(this , extension, getScriptProxy());
846: } catch (Exception ex) {
847: throw new IllegalArgumentException("Unsupported type: "
848: + jsx3.chart.ChartLabel.class.getName());
849: }
850: }
851:
852: /**
853: * Returns the opposing axis.
854: */
855: @SuppressWarnings("unchecked")
856: public jsx3.chart.Axis getOpposingAxis() {
857: String extension = "getOpposingAxis().";
858: try {
859: java.lang.reflect.Constructor<jsx3.chart.Axis> ctor = jsx3.chart.Axis.class
860: .getConstructor(Context.class, String.class,
861: ScriptProxy.class);
862: return ctor.newInstance(this , extension, getScriptProxy());
863: } catch (Exception ex) {
864: throw new IllegalArgumentException("Unsupported type: "
865: + jsx3.chart.Axis.class.getName());
866: }
867: }
868:
869: /**
870: * Returns the opposing axis.
871: * @param returnType The expected return type
872: */
873: @SuppressWarnings("unchecked")
874: public <T> T getOpposingAxis(Class<T> returnType) {
875: String extension = "getOpposingAxis().";
876: try {
877: java.lang.reflect.Constructor<T> ctor = returnType
878: .getConstructor(Context.class, String.class,
879: ScriptProxy.class);
880: return ctor.newInstance(this , extension, getScriptProxy());
881: } catch (Exception ex) {
882: throw new IllegalArgumentException(
883: "Unsupported return type: " + returnType.getName());
884: }
885: }
886:
887: }
|