Source Code Cross Referenced for PieChart.java in  » Ajax » dwr » jsx3 » chart » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » dwr » jsx3.chart 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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 pie chart.
024:
025:         Series: PieSeries only. 
026:         Axes: No axes, it's a radial chart.
027:         * @author Joe Walker [joe at getahead dot org]
028:         * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
029:         */
030:        public class PieChart extends jsx3.chart.RadialChart {
031:            /**
032:             * All reverse ajax proxies need context to work from
033:             * @param scriptProxy The place we are writing scripts to
034:             * @param context The script that got us to where we are now
035:             */
036:            public PieChart(Context context, String extension,
037:                    ScriptProxy scriptProxy) {
038:                super (context, extension, scriptProxy);
039:            }
040:
041:            /**
042:             * The instance initializer.
043:             * @param name the GI name of the instance
044:             * @param left left position (in pixels) of the chart relative to its parent container
045:             * @param top top position (in pixels) of the chart relative to its parent container
046:             * @param width width (in pixels) of the chart
047:             * @param height height (in pixels) of the chart
048:             */
049:            public PieChart(String name, int left, int top, int width,
050:                    int height) {
051:                super ((Context) null, (String) null, (ScriptProxy) null);
052:                ScriptBuffer script = new ScriptBuffer();
053:                script.appendCall("new PieChart", name, left, top, width,
054:                        height);
055:                setInitScript(script);
056:            }
057:
058:            /**
059:             * Returns the innerRadius field, the radius as the hole in the middle of the pie as a ratio of the entire radius.
060:             * @param callback innerRadius
061:             */
062:            @SuppressWarnings("unchecked")
063:            public void getInnerRadius(
064:                    org.directwebremoting.proxy.Callback<Float> callback) {
065:                ScriptBuffer script = new ScriptBuffer();
066:                String callbackPrefix = "";
067:
068:                if (callback != null) {
069:                    callbackPrefix = "var reply = ";
070:                }
071:
072:                script.appendCall(callbackPrefix + getContextPath()
073:                        + "getInnerRadius");
074:
075:                if (callback != null) {
076:                    String key = org.directwebremoting.extend.CallbackHelper
077:                            .saveCallback(callback, Float.class);
078:                    script
079:                            .appendCall("__System.activateCallback", key,
080:                                    "reply");
081:                }
082:
083:                getScriptProxy().addScript(script);
084:            }
085:
086:            /**
087:             * Sets the innerRadius field.
088:             * @param innerRadius the new value for innerRadius, between 0.0 and 1.0
089:             */
090:            public void setInnerRadius(float innerRadius) {
091:                ScriptBuffer script = new ScriptBuffer();
092:                script.appendCall(getContextPath() + "setInnerRadius",
093:                        innerRadius);
094:                getScriptProxy().addScript(script);
095:            }
096:
097:            /**
098:             * Returns the seriesPadding field, the amount of padding between rings in a doughnut chart as a ratio of the width of a ring.
099:             * @param callback seriesPadding
100:             */
101:            @SuppressWarnings("unchecked")
102:            public void getSeriesPadding(
103:                    org.directwebremoting.proxy.Callback<Float> callback) {
104:                ScriptBuffer script = new ScriptBuffer();
105:                String callbackPrefix = "";
106:
107:                if (callback != null) {
108:                    callbackPrefix = "var reply = ";
109:                }
110:
111:                script.appendCall(callbackPrefix + getContextPath()
112:                        + "getSeriesPadding");
113:
114:                if (callback != null) {
115:                    String key = org.directwebremoting.extend.CallbackHelper
116:                            .saveCallback(callback, Float.class);
117:                    script
118:                            .appendCall("__System.activateCallback", key,
119:                                    "reply");
120:                }
121:
122:                getScriptProxy().addScript(script);
123:            }
124:
125:            /**
126:             * Sets the seriesPadding field.
127:             * @param seriesPadding the new value for seriesPadding, positive value, not too big
128:             */
129:            public void setSeriesPadding(float seriesPadding) {
130:                ScriptBuffer script = new ScriptBuffer();
131:                script.appendCall(getContextPath() + "setSeriesPadding",
132:                        seriesPadding);
133:                getScriptProxy().addScript(script);
134:            }
135:
136:            /**
137:             * Returns the totalAngle field, the total angle used for each series; may be overridden on a series-by-series basis by jsx3.chart.PieSeries.totalAngle.
138:             * @param callback totalAngle
139:             */
140:            @SuppressWarnings("unchecked")
141:            public void getTotalAngle(
142:                    org.directwebremoting.proxy.Callback<Integer> callback) {
143:                ScriptBuffer script = new ScriptBuffer();
144:                String callbackPrefix = "";
145:
146:                if (callback != null) {
147:                    callbackPrefix = "var reply = ";
148:                }
149:
150:                script.appendCall(callbackPrefix + getContextPath()
151:                        + "getTotalAngle");
152:
153:                if (callback != null) {
154:                    String key = org.directwebremoting.extend.CallbackHelper
155:                            .saveCallback(callback, Integer.class);
156:                    script
157:                            .appendCall("__System.activateCallback", key,
158:                                    "reply");
159:                }
160:
161:                getScriptProxy().addScript(script);
162:            }
163:
164:            /**
165:             * Sets the totalAngle field.
166:             * @param totalAngle the new value for totalAngle, between 0 and 360
167:             */
168:            public void setTotalAngle(int totalAngle) {
169:                ScriptBuffer script = new ScriptBuffer();
170:                script.appendCall(getContextPath() + "setTotalAngle",
171:                        totalAngle);
172:                getScriptProxy().addScript(script);
173:            }
174:
175:            /**
176:             * Returns the startAngle field, the start angle of the first slice in each series; 0 points upwards and increasing values go clockwise; may be overridden on a series-by-series basis by jsx3.chart.PieSeries.startAngle.
177:             * @param callback startAngle
178:             */
179:            @SuppressWarnings("unchecked")
180:            public void getStartAngle(
181:                    org.directwebremoting.proxy.Callback<Integer> callback) {
182:                ScriptBuffer script = new ScriptBuffer();
183:                String callbackPrefix = "";
184:
185:                if (callback != null) {
186:                    callbackPrefix = "var reply = ";
187:                }
188:
189:                script.appendCall(callbackPrefix + getContextPath()
190:                        + "getStartAngle");
191:
192:                if (callback != null) {
193:                    String key = org.directwebremoting.extend.CallbackHelper
194:                            .saveCallback(callback, Integer.class);
195:                    script
196:                            .appendCall("__System.activateCallback", key,
197:                                    "reply");
198:                }
199:
200:                getScriptProxy().addScript(script);
201:            }
202:
203:            /**
204:             * Sets the startAngle field.
205:             * @param startAngle the new value for startAngle, between 0 and 360
206:             */
207:            public void setStartAngle(int startAngle) {
208:                ScriptBuffer script = new ScriptBuffer();
209:                script.appendCall(getContextPath() + "setStartAngle",
210:                        startAngle);
211:                getScriptProxy().addScript(script);
212:            }
213:
214:            /**
215:             * Returns the categoryField field, the attribute of a record that contains the category name value; necessary because there is no CategoryAxis to define this in a radial chart.
216:             * @param callback categoryField
217:             */
218:            @SuppressWarnings("unchecked")
219:            public void getCategoryField(
220:                    org.directwebremoting.proxy.Callback<String> callback) {
221:                ScriptBuffer script = new ScriptBuffer();
222:                String callbackPrefix = "";
223:
224:                if (callback != null) {
225:                    callbackPrefix = "var reply = ";
226:                }
227:
228:                script.appendCall(callbackPrefix + getContextPath()
229:                        + "getCategoryField");
230:
231:                if (callback != null) {
232:                    String key = org.directwebremoting.extend.CallbackHelper
233:                            .saveCallback(callback, String.class);
234:                    script
235:                            .appendCall("__System.activateCallback", key,
236:                                    "reply");
237:                }
238:
239:                getScriptProxy().addScript(script);
240:            }
241:
242:            /**
243:             * Sets the categoryField field.
244:             * @param categoryField the new value for categoryField
245:             */
246:            public void setCategoryField(String categoryField) {
247:                ScriptBuffer script = new ScriptBuffer();
248:                script.appendCall(getContextPath() + "setCategoryField",
249:                        categoryField);
250:                getScriptProxy().addScript(script);
251:            }
252:
253:            /**
254:             * Returns the colors field, an array of string representations of a vector fill, to color in the slices of all the data series; may be overridden by jsx3.chart.PieSeries.colors for an individual series..
255:             * @param callback colors
256:             */
257:            @SuppressWarnings("unchecked")
258:            public void getColors(
259:                    org.directwebremoting.proxy.Callback<Object[]> callback) {
260:                ScriptBuffer script = new ScriptBuffer();
261:                String callbackPrefix = "";
262:
263:                if (callback != null) {
264:                    callbackPrefix = "var reply = ";
265:                }
266:
267:                script.appendCall(callbackPrefix + getContextPath()
268:                        + "getColors");
269:
270:                if (callback != null) {
271:                    String key = org.directwebremoting.extend.CallbackHelper
272:                            .saveCallback(callback, Object[].class);
273:                    script
274:                            .appendCall("__System.activateCallback", key,
275:                                    "reply");
276:                }
277:
278:                getScriptProxy().addScript(script);
279:            }
280:
281:            /**
282:             * Sets the colors field.
283:             * @param colors the new value for colors
284:             */
285:            public void setColors(Object[] colors) {
286:                ScriptBuffer script = new ScriptBuffer();
287:                script.appendCall(getContextPath() + "setColors", colors);
288:                getScriptProxy().addScript(script);
289:            }
290:
291:            /**
292:             * Returns the colorFunction field, a function that defines how to color in the slices of each data series in this chart, with the signature function(record, index) : jsx3.vector.Fill; may be overridden by jsx3.chart.PieSeries.colorFunction for an individual series..
293:             * @param callback colorFunction
294:             */
295:            @SuppressWarnings("unchecked")
296:            public void getColorFunction(
297:                    org.directwebremoting.proxy.Callback<org.directwebremoting.proxy.CodeBlock> callback) {
298:                ScriptBuffer script = new ScriptBuffer();
299:                String callbackPrefix = "";
300:
301:                if (callback != null) {
302:                    callbackPrefix = "var reply = ";
303:                }
304:
305:                script.appendCall(callbackPrefix + getContextPath()
306:                        + "getColorFunction");
307:
308:                if (callback != null) {
309:                    String key = org.directwebremoting.extend.CallbackHelper
310:                            .saveCallback(callback,
311:                                    org.directwebremoting.proxy.CodeBlock.class);
312:                    script
313:                            .appendCall("__System.activateCallback", key,
314:                                    "reply");
315:                }
316:
317:                getScriptProxy().addScript(script);
318:            }
319:
320:            /**
321:             * Sets the colorFunction field.
322:             * @param colorFunction the new value for colorFunction, should eval to a function with the signature function(record, index) : jsx3.vector.Fill
323:             */
324:            public void setColorFunction(String colorFunction) {
325:                ScriptBuffer script = new ScriptBuffer();
326:                script.appendCall(getContextPath() + "setColorFunction",
327:                        colorFunction);
328:                getScriptProxy().addScript(script);
329:            }
330:
331:            /**
332:             * Returns the seriesStroke field, string representation of a VectorStroke to outline the slices of all the series with; may be overridden by jsx3.chart.PieSeries.stroke for an individual series..
333:             * @param callback seriesStroke
334:             */
335:            @SuppressWarnings("unchecked")
336:            public void getSeriesStroke(
337:                    org.directwebremoting.proxy.Callback<String> callback) {
338:                ScriptBuffer script = new ScriptBuffer();
339:                String callbackPrefix = "";
340:
341:                if (callback != null) {
342:                    callbackPrefix = "var reply = ";
343:                }
344:
345:                script.appendCall(callbackPrefix + getContextPath()
346:                        + "getSeriesStroke");
347:
348:                if (callback != null) {
349:                    String key = org.directwebremoting.extend.CallbackHelper
350:                            .saveCallback(callback, String.class);
351:                    script
352:                            .appendCall("__System.activateCallback", key,
353:                                    "reply");
354:                }
355:
356:                getScriptProxy().addScript(script);
357:            }
358:
359:            /**
360:             * Sets the seriesStroke field.
361:             * @param seriesStroke the new value for seriesStroke
362:             */
363:            public void setSeriesStroke(String seriesStroke) {
364:                ScriptBuffer script = new ScriptBuffer();
365:                script.appendCall(getContextPath() + "setSeriesStroke",
366:                        seriesStroke);
367:                getScriptProxy().addScript(script);
368:            }
369:
370:            /**
371:             * default coloring scheme for pie series, simply converts the default coloring scheme for series into a coloring scheme for categories
372:             * @param record 
373:             * @param index the index of the record in the data provider
374:             */
375:            @SuppressWarnings("unchecked")
376:            public jsx3.vector.Fill defaultColoring(jsx3.xml.Node record,
377:                    int index) {
378:                String extension = "defaultColoring(\"" + record + "\", \""
379:                        + index + "\").";
380:                try {
381:                    java.lang.reflect.Constructor<jsx3.vector.Fill> ctor = jsx3.vector.Fill.class
382:                            .getConstructor(Context.class, String.class,
383:                                    ScriptProxy.class);
384:                    return ctor.newInstance(this , extension, getScriptProxy());
385:                } catch (Exception ex) {
386:                    throw new IllegalArgumentException("Unsupported type: "
387:                            + jsx3.vector.Fill.class.getName());
388:                }
389:            }
390:
391:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.