KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icesoft > faces > component > outputchart > OutputChart


1 /*
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * "The contents of this file are subject to the Mozilla Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
11  * License for the specific language governing rights and limitations under
12  * the License.
13  *
14  * The Original Code is ICEfaces 1.5 open source software code, released
15  * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
16  * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
17  * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
18  *
19  * Contributor(s): _____________________.
20  *
21  * Alternatively, the contents of this file may be used under the terms of
22  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
23  * License), in which case the provisions of the LGPL License are
24  * applicable instead of those above. If you wish to allow use of your
25  * version of this file only under the terms of the LGPL License and not to
26  * allow others to use your version of this file under the MPL, indicate
27  * your decision by deleting the provisions above and replace them with
28  * the notice and other provisions required by the LGPL License. If you do
29  * not delete the provisions above, a recipient may use your version of
30  * this file under either the MPL or the LGPL License."
31  *
32  */

33
34 package com.icesoft.faces.component.outputchart;
35
36 import com.icesoft.faces.component.CSS_DEFAULT;
37 import com.icesoft.faces.component.ext.HtmlCommandButton;
38 import com.icesoft.faces.component.ext.renderkit.FormRenderer;
39 import com.icesoft.faces.component.ext.taglib.Util;
40 import com.icesoft.faces.context.DOMContext;
41 import com.icesoft.faces.context.DOMResponseWriter;
42 import org.krysalis.jcharts.Chart;
43 import org.krysalis.jcharts.imageMap.ImageMapArea;
44 import org.w3c.dom.Element JavaDoc;
45 import org.w3c.dom.Text JavaDoc;
46
47 import javax.faces.component.UIComponent;
48 import javax.faces.context.ExternalContext;
49 import javax.faces.context.FacesContext;
50 import javax.faces.el.MethodBinding;
51 import javax.faces.el.ValueBinding;
52 import javax.faces.event.AbortProcessingException;
53 import javax.faces.event.ActionEvent;
54 import javax.faces.event.FacesEvent;
55 import javax.faces.event.ActionListener;
56 import javax.servlet.ServletContext JavaDoc;
57 import javax.servlet.http.HttpServletRequest JavaDoc;
58
59 import java.beans.Beans JavaDoc;
60 import java.io.File JavaDoc;
61 import java.io.FileNotFoundException JavaDoc;
62 import java.io.FileOutputStream JavaDoc;
63 import java.io.IOException JavaDoc;
64 import java.io.OutputStream JavaDoc;
65 import java.io.Serializable JavaDoc;
66 import java.util.Iterator JavaDoc;
67 import java.util.Map JavaDoc;
68
69 public class OutputChart extends HtmlCommandButton implements Serializable JavaDoc {
70
71     public static String JavaDoc AREA_CHART_TYPE = "area";
72     public static String JavaDoc AREA_STACKED_CHART_TYPE = "areastacked";
73     public static String JavaDoc BAR_CHART_TYPE = "bar";
74     public static String JavaDoc BAR_CLUSTERED_CHART_TYPE = "barclustered";
75     public static String JavaDoc BAR_STACKED_CHART_TYPE = "barstacked";
76     public static String JavaDoc LINE_CHART_TYPE = "line";
77     public static String JavaDoc PIE2D_CHART_TYPE = "pie2D";
78     public static String JavaDoc PIE3D_CHART_TYPE = "pie3D";
79     public static String JavaDoc POINT_CHART_TYPE = "point";
80     public static String JavaDoc STOCK_CHART_TYPE = "stock";
81     public static String JavaDoc CUSTOM_CHART_TYPE = "custom";
82     public static String JavaDoc DEFAULT_CHART_TYPE = BAR_CHART_TYPE;
83
84     private static int COMPONENT_ID = 0;
85     private static int CLIENT_SIDE_IMAGE_MAP_KEY = 1;
86     private static String JavaDoc DEFAULT_HEIGHT = "400";
87     private static String JavaDoc DEFAULT_WIDTH = "400";
88
89     private static String JavaDoc DEFAULT_CHART_TITLE = "Default Chart title";
90     private static String JavaDoc DEFAULT_YAXIS_TITLE = "Default Y title";
91     private static String JavaDoc DEFAULT_XAXIS_TITLE = "Default X title";
92     private static String JavaDoc DEFAULT_DATA = "20, 30, 40";
93     static String JavaDoc ICE_CHART_COMPONENT = "iceChartComponent";
94     private int imageCounter = 0;
95     private AbstractChart abstractChart;
96     private String JavaDoc width;
97     private String JavaDoc height;
98
99     private boolean render = false;
100     private FileOutputStream JavaDoc out;
101
102     private String JavaDoc chartTitle;
103     private Object JavaDoc data;
104     private Object JavaDoc labels;
105     private Object JavaDoc colors;
106     private Object JavaDoc shapes;
107
108     private Object JavaDoc xaxisLabels;
109     private String JavaDoc xaxisTitle;
110     private String JavaDoc yaxisTitle;
111     private String JavaDoc style = null;
112     private String JavaDoc styleClass = null;
113     private Object JavaDoc legendPlacement;
114     private Object JavaDoc legendColumns;
115     private boolean horizontal;
116     private boolean horizontalSet;
117     File JavaDoc folder = null;
118
119     public OutputChart() {
120         setRendererType("com.icesoft.faces.OutputChartRenderer");
121     }
122
123
124     /**
125      *<p>Return the value of the <code>labels</code> property.</p>
126      */

127     public Object JavaDoc getLabels() {
128         if (labels != null) {
129             return labels;
130         }
131         ValueBinding vb = getValueBinding("labels");
132         return vb != null ? vb.getValue(getFacesContext()) : null;
133     }
134
135     /**
136      * <p>Set the value of the <code>labels</code> property. </p>
137      */

138     public void setLabels(Object JavaDoc labels) {
139         this.labels = labels;
140     }
141
142     /**
143      *<p>Return a boolean flag which tells if the chart can have a
144      *clientSideImageMap or not.</p>
145      */

146     public boolean isClientSideImageMap() {
147         if (hasActionListener() &&
148             (!getType().equalsIgnoreCase(AREA_CHART_TYPE) &&
149              !getType().equalsIgnoreCase(AREA_STACKED_CHART_TYPE))) {
150             return true;
151         } else {
152             return false;
153         }
154     }
155     
156     protected boolean hasActionListener() {
157         MethodBinding actionListener = getActionListener();
158         if( actionListener != null ) {
159             return true;
160         }
161         ActionListener[] actionListeners = getActionListeners();
162         if( actionListeners != null && actionListeners.length > 0 ) {
163             return true;
164         }
165         return false;
166     }
167     
168     /**
169      *<p>Return the value of the <code>data</code> property.</p>
170      */

171     public Object JavaDoc getData() {
172         if (data != null) {
173             return data;
174         }
175         ValueBinding vb = getValueBinding("data");
176         if (vb != null) {
177             return vb.getValue(getFacesContext());
178         } else {
179             
180             if(!Beans.isDesignTime()){
181                 setChartTitle(getChartTitle() + " with default data");
182             }
183             return DEFAULT_DATA;
184         }
185     }
186
187     /**
188      * <p>Set the value of the <code>data</code> property. </p>
189      */

190     public void setData(Object JavaDoc data) {
191         this.data = data;
192     }
193
194     /**
195      *<p>Return the value of the <code>colors</code> property.</p>
196      */

197     public Object JavaDoc getColors() {
198         if (colors != null) {
199             return colors;
200         }
201         ValueBinding vb = getValueBinding("colors");
202         return vb != null ? vb.getValue(getFacesContext()) : null;
203     }
204
205     /**
206      * <p>Set the value of the <code>colors</code> property. </p>
207      */

208     public void setColors(Object JavaDoc colors) {
209         this.colors = colors;
210     }
211
212     /**
213      *<p>Return the value of the <code>shapes</code> property.</p>
214      */

215     public Object JavaDoc getShapes() {
216         if (shapes != null) {
217             return shapes;
218         }
219         ValueBinding vb = getValueBinding("shapes");
220         return vb != null ? vb.getValue(getFacesContext()) : null;
221     }
222
223     /**
224      * <p>Set the value of the <code>shapes</code> property. </p>
225      */

226     public void setShapes(Object JavaDoc shapes) {
227         this.shapes = shapes;
228     }
229
230     /**
231      *<p>Return the value of the <code>xaxisTitle</code> property.</p>
232      */

233     public String JavaDoc getXaxisTitle() {
234         if (xaxisTitle != null) {
235             return xaxisTitle;
236         }
237         ValueBinding vb = getValueBinding("xaxisTitle");
238         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
239                DEFAULT_XAXIS_TITLE;
240     }
241
242     /**
243      * <p>Set the value of the <code>xaxisTitle</code> property. </p>
244      */

245     public void setXaxisTitle(String JavaDoc xaxisTitle) {
246         this.xaxisTitle = xaxisTitle;
247     }
248
249     /**
250      *<p>Return the value of the <code>yaxisTitle</code> property.</p>
251      */

252     public String JavaDoc getYaxisTitle() {
253         if (yaxisTitle != null) {
254             return yaxisTitle;
255         }
256         ValueBinding vb = getValueBinding("yaxisTitle");
257         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
258                DEFAULT_YAXIS_TITLE;
259     }
260
261     /**
262      * <p>Set the value of the <code>yaxisTitle</code> property. </p>
263      */

264     public void setYaxisTitle(String JavaDoc yaxisTitle) {
265         this.yaxisTitle = yaxisTitle;
266     }
267
268     /**
269      *<p>Return the value of the <code>xaxisLabels</code> property.</p>
270      */

271     public Object JavaDoc getXaxisLabels() {
272         if (xaxisLabels != null) {
273             return xaxisLabels;
274         }
275         ValueBinding vb = getValueBinding("xaxisLabels");
276         return vb != null ? vb.getValue(getFacesContext()) : null;
277     }
278
279     /**
280      * <p>Set the value of the <code>xaxisLabels</code> property. </p>
281      */

282     public void setXaxisLabels(Object JavaDoc xaxisLabels) {
283         this.xaxisLabels = xaxisLabels;
284     }
285
286     /**
287      *<p>Return the value of the <code>chartTitle</code> property.</p>
288      */

289     public String JavaDoc getChartTitle() {
290         if (chartTitle != null) {
291             return chartTitle;
292         }
293         ValueBinding vb = getValueBinding("chartTitle");
294         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
295                DEFAULT_CHART_TITLE;
296     }
297
298     /**
299      * <p>Set the value of the <code>chartTitle</code> property. </p>
300      */

301     public void setChartTitle(String JavaDoc chartTitle) {
302         this.chartTitle = chartTitle;
303     }
304
305     /**
306      *<p>Return the value of the <code>width</code> property.</p>
307      */

308     public String JavaDoc getWidth() {
309         if (width != null) {
310             return width;
311         }
312         ValueBinding vb = getValueBinding("width");
313         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
314                DEFAULT_WIDTH;
315     }
316
317     /**
318      * <p>Set the value of the <code>width</code> property. </p>
319      */

320     public void setWidth(String JavaDoc width) {
321         this.width = width;
322     }
323
324     /**
325      *<p>Return the value of the <code>height</code> property.</p>
326      */

327     public String JavaDoc getHeight() {
328         if (height != null) {
329             return height;
330         }
331         ValueBinding vb = getValueBinding("height");
332         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
333                DEFAULT_HEIGHT;
334     }
335
336     /**
337      * <p>Set the value of the <code>height</code> property. </p>
338      */

339     public void setHeight(String JavaDoc height) {
340         this.height = height;
341     }
342
343     private MethodBinding renderOnSubmitMethodBinding;
344
345     public void setRenderOnSubmit(MethodBinding renderOnSubmit) {
346         renderOnSubmitMethodBinding = renderOnSubmit;
347     }
348     
349     public MethodBinding getRenderOnSubmit() {
350         return renderOnSubmitMethodBinding;
351     }
352
353     public Boolean JavaDoc evaluateRenderOnSubmit(FacesContext context) {
354         if (renderOnSubmitMethodBinding != null) {
355             Boolean JavaDoc b = (Boolean JavaDoc) renderOnSubmitMethodBinding.invoke(
356                 context, new Object JavaDoc[]{this});
357             return b;
358         }
359         return Boolean.FALSE;
360     }
361
362     /*
363      * (non-Javadoc)
364      * @see javax.faces.component.UIComponent#encodeBegin(javax.faces.context.FacesContext)
365      */

366     public void encodeBegin(FacesContext context) throws IOException JavaDoc {
367         
368         if(!Beans.isDesignTime()){
369             try {
370                 if (abstractChart == null) {
371                     abstractChart = AbstractChart.createChart(this);
372                     if (getType().equalsIgnoreCase(OutputChart.CUSTOM_CHART_TYPE)) {
373                         evaluateRenderOnSubmit(context);
374                     }
375                     abstractChart.encode();
376                 } else if (evaluateRenderOnSubmit(context).booleanValue()) {
377                     abstractChart.encode();
378                 }
379             } catch (Throwable JavaDoc e) {
380                 e.printStackTrace();
381             }
382         }
383         super.encodeBegin(context);
384     }
385
386     /*
387      * (non-Javadoc)
388      * @see javax.faces.component.UIComponent#broadcast(javax.faces.event.FacesEvent)
389      */

390     public void broadcast(FacesEvent event)
391             throws AbortProcessingException {
392         super.broadcast(event);
393     }
394
395     /*
396      * (non-Javadoc)
397      * @see javax.faces.component.UIComponent#decode(javax.faces.context.FacesContext)
398      */

399     public void decode(FacesContext context) {
400
401         Map JavaDoc requestParameterMap =
402                 context.getExternalContext().getRequestParameterMap();
403         String JavaDoc chartComponentRequestIdentifier = (String JavaDoc) requestParameterMap
404                 .get(OutputChart.ICE_CHART_COMPONENT);
405         if (chartComponentRequestIdentifier != null) {
406             String JavaDoc[] submittedValue =
407                     chartComponentRequestIdentifier.split("id-key");
408             if (submittedValue[COMPONENT_ID].equals(getClientId(context))) {
409                 ImageMapArea area = (ImageMapArea) getGeneratedImageMapArea()
410                         .get(submittedValue[CLIENT_SIDE_IMAGE_MAP_KEY]);
411                 if (area != null) {
412                     setClickedImageMapArea(area);
413                     queueEvent(new ActionEvent(this));
414                 }
415             }
416         }
417         super.decode(context);
418     }
419
420     private String JavaDoc getChartFileName() {
421         HttpServletRequest JavaDoc req =
422                 (HttpServletRequest JavaDoc) ((ExternalContext) FacesContext
423                         .getCurrentInstance().getExternalContext())
424                         .getRequest();
425         return this.getType() + this
426                 .getClientId(FacesContext.getCurrentInstance())
427                 .replaceAll(":", "") + req.getRequestedSessionId() +
428                                      imageCounter++ + ".jpeg";
429     }
430
431     /**
432      *<p>Return the the path where the chart is stored.</p>
433      */

434     public String JavaDoc getPath() {
435         String JavaDoc folder = "/";
436         if (getFacesContext() != null &&
437             getFacesContext().getExternalContext() != null) {
438             if (DOMResponseWriter.isStreamWriting()) {
439                 folder = "./web/chart/images";
440             } else {
441                 folder =
442                         ((ServletContext JavaDoc) getFacesContext().getExternalContext()
443                                 .getContext()).getRealPath("/charts");
444             }
445         }
446         return folder;
447     }
448     /**
449      *<p>Return the value of the <code>chart</code> property.</p>
450      */

451     public Chart getChart() {
452         return abstractChart.getChart();
453     }
454
455     /**
456      * <p>Set the value of the <code>chart</code> property. </p>
457      */

458     public void setChart(Chart chart) {
459         abstractChart.setChart(chart);
460     }
461
462     public void render() {
463         render = true;
464     }
465     
466     public boolean isRender() {
467         return render;
468     }
469
470     private String JavaDoc type = null;
471
472     /**
473      * <p>Set the value of the <code>type</code> property. </p>
474      */

475     public void setType(String JavaDoc type) {
476         this.type = type;
477     }
478
479     /**
480      *<p>Return the value of the <code>type</code> property.</p>
481      */

482     public String JavaDoc getType() {
483         if (type != null) {
484             return type;
485         }
486         ValueBinding vb = getValueBinding("type");
487         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
488                DEFAULT_CHART_TYPE;
489     }
490
491     private String JavaDoc fileName = null;
492
493     /**
494      *<p>Return the value of the <code>fileName</code> property.</p>
495      */

496     public String JavaDoc getFileName() {
497         return fileName;
498     }
499
500     private File JavaDoc imageFile;
501
502     /**
503      *<p>Return the value of the <code>data</code> property.</p>
504      */

505     OutputStream JavaDoc getNewOutputStream() {
506         //removed the old image, if exist
507
if (imageFile != null) {
508             imageFile.delete();
509         }
510         imageFile = new File JavaDoc(getFolder(), getChartFileName());
511         fileName = imageFile.getName();
512         try {
513             return out = new FileOutputStream JavaDoc(imageFile);
514         } catch (FileNotFoundException JavaDoc e) {
515             // TODO Auto-generated catch block
516
e.printStackTrace();
517         }
518         return null;
519     }
520
521     File JavaDoc getFolder() {
522         
523         if(Beans.isDesignTime()){
524             folder = new File JavaDoc(getPath());
525             return folder;
526         }
527         
528         if (folder == null) {
529             folder = new File JavaDoc(getPath());
530             if (folder != null) {
531                 if (!folder.exists()) {
532                     folder.mkdirs();
533                 }
534             }
535         }
536         return folder;
537     }
538
539     /**
540      *<p>Return the value of the <code>data</code> property.</p>
541      */

542     public OutputStream JavaDoc getOutputStream() {
543         return out;
544     }
545
546     Map JavaDoc getGeneratedImageMapArea() {
547         return abstractChart.getGeneratedImageMapArea();
548     }
549
550     /**
551      *<p>Return the value of the <code>data</code> property.</p>
552      */

553     public ImageMapArea getClickedImageMapArea() {
554         return abstractChart.getClickedImageMapArea();
555     }
556
557     public void setClickedImageMapArea(ImageMapArea clickedImageMapArea) {
558         abstractChart.setClickedImageMapArea(clickedImageMapArea);
559     }
560
561     void generateClientSideImageMap(DOMContext domContext, Element JavaDoc map) {
562         if (isClientSideImageMap()) {
563             Iterator JavaDoc area = getGeneratedImageMapArea().values().iterator();
564             while (area.hasNext()) {
565                 ImageMapArea areaMap = (ImageMapArea) area.next();
566                 Text JavaDoc areaNode = domContext.createTextNode(areaMap.toHTML(
567                         "title ='" + areaMap.getLengendLabel() +
568                         "' HREF=\"return false;\" onclick=\"document.forms['" +
569                         getParentFormId() + "']['" + ICE_CHART_COMPONENT +
570                         "'].value='" + getClientId(getFacesContext()) +
571                         "id-key" + areaMap.hashCode() +
572                         "';iceSubmitPartial(document.forms['" +
573                         getParentFormId() + "'],this,event); return false;\""));
574                 map.appendChild(areaNode);
575             }
576         } else {
577             //logging client side image Map was not enabled
578
}
579     }
580
581     //cache parentFormId, if ClientSideImageMap is required
582
private String JavaDoc parentFormId;
583
584     private String JavaDoc getParentFormId() {
585         if (parentFormId != null) {
586             return parentFormId;
587         }
588         UIComponent uiForm = FormRenderer.findForm(this);
589         if (uiForm == null) {
590             //TODO logging and exception
591
//The component must have to be a decendent of the for element, inorder to use clientSideImageMap
592
return null;
593         }
594         return (parentFormId = uiForm.getClientId(getFacesContext()));
595     }
596
597     /**
598      * <p>Set the value of the <code>styleClass</code> property.</p>
599      */

600     public void setStyleClass(String JavaDoc styleClass) {
601         this.styleClass = styleClass;
602     }
603
604     /**
605      * <p>Return the value of the <code>styleClass</code> property.</p>
606      */

607     public String JavaDoc getStyleClass() {
608         return Util.getQualifiedStyleClass(this,
609                 styleClass,
610                 CSS_DEFAULT.OUTPUT_CHART_DEFAULT_STYLE_CLASS,
611                 "styleClass");
612     }
613
614     /**
615      * <p>Set the value of the <code>style</code> property.</p>
616      */

617     public void setStyle(String JavaDoc style) {
618         this.style = style;
619     }
620
621     /**
622      * <p>Return the value of the <code>style</code> property.</p>
623      */

624     public String JavaDoc getStyle() {
625         if (style != null) {
626             return style;
627         }
628         ValueBinding vb = getValueBinding("style");
629         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) : null;
630     }
631     
632     /**
633      *<p>Return the value of the <code>legendLabel</code> property.</p>
634      */

635     public Object JavaDoc getLegendPlacement() {
636         if (legendPlacement != null) {
637             return legendPlacement;
638         }
639         ValueBinding vb = getValueBinding("legendPlacement");
640         return vb != null ? vb.getValue(getFacesContext()) : "bottom";
641     }
642
643     /**
644      * <p>Set the value of the <code>legendPlacement</code> property. </p>
645      */

646     public void setLegendPlacement(Object JavaDoc legendPlacement) {
647         this.legendPlacement = legendPlacement;
648     }
649     
650     /**
651      *<p>Return the value of the <code>legendColumns</code> property.</p>
652      */

653     public Object JavaDoc getLegendColumns() {
654         if (legendColumns != null) {
655             return legendColumns;
656         }
657         ValueBinding vb = getValueBinding("legendColumns");
658         return vb != null ? vb.getValue(getFacesContext()) : "0";
659     }
660
661     /**
662      * <p>Set the value of the <code>legendColumns</code> property. </p>
663      */

664     public void setLegendColumns(Object JavaDoc legendColumns) {
665         this.legendColumns = legendColumns;
666     }
667
668
669     public boolean isHorizontal() {
670         if (this.horizontalSet) {
671             return (this.horizontal);
672         }
673         ValueBinding vb = getValueBinding("horizontal");
674         if (vb != null) {
675             return (Boolean.TRUE.equals(vb.getValue(getFacesContext())));
676         } else {
677             return (this.horizontal);
678         }
679     }
680
681
682     public void setHorizontal(boolean horizontal) {
683         if (horizontal != this.horizontal) {
684             this.horizontal = horizontal;
685         }
686         this.horizontalSet = true;
687     }
688     
689     /**
690      * <p>Gets the state of the instance as a <code>Serializable</code>
691      * Object.</p>
692      */

693     public Object JavaDoc saveState(FacesContext context) {
694         Object JavaDoc values[] = new Object JavaDoc[22];
695         values[0] = super.saveState(context);
696         values[1] = new Integer JavaDoc(imageCounter);
697         values[2] = abstractChart;
698         values[3] = width;
699         values[4] = height;
700         values[5] = render ? Boolean.TRUE : Boolean.FALSE;
701         values[6] = chartTitle;
702         values[7] = data;
703         values[8] = labels;
704         values[9] = colors;
705         values[10] = shapes;
706         values[11] = xaxisLabels;
707         values[12] = xaxisTitle;
708         values[13] = yaxisTitle;
709         values[14] = style;
710         values[15] = styleClass;
711         values[16] = legendPlacement;
712         values[17] = legendColumns;
713         values[18] = horizontal ? Boolean.TRUE : Boolean.FALSE;
714         values[19] = horizontalSet ? Boolean.TRUE : Boolean.FALSE;
715         values[20] = type;
716         values[21] = saveAttachedState(context, renderOnSubmitMethodBinding);
717         return ((Object JavaDoc) (values));
718     }
719
720     /**
721      * <p>Perform any processing required to restore the state from the entries
722      * in the state Object.</p>
723      */

724     public void restoreState(FacesContext context, Object JavaDoc state) {
725         Object JavaDoc values[] = (Object JavaDoc[]) state;
726         super.restoreState(context, values[0]);
727         imageCounter = ((Integer JavaDoc) values[1]).intValue();
728         abstractChart = (AbstractChart) values[2];
729         width = (String JavaDoc) values[3];
730         height = (String JavaDoc) values[4];
731         render = ((Boolean JavaDoc) values[5]).booleanValue();
732         chartTitle = (String JavaDoc) values[6];
733         data = values[7];
734         labels = values[8];
735         colors = values[9];
736         shapes = values[10];
737         xaxisLabels = values[11];
738         xaxisTitle = (String JavaDoc) values[12];
739         yaxisTitle = (String JavaDoc) values[13];
740         style = (String JavaDoc) values[14];
741         styleClass = (String JavaDoc) values[15];
742         legendPlacement = values[16];
743         legendColumns = values[17];
744         horizontal = ((Boolean JavaDoc) values[18]).booleanValue();
745         horizontalSet = ((Boolean JavaDoc) values[19]).booleanValue();
746         type = (String JavaDoc) values[20];
747         renderOnSubmitMethodBinding = (MethodBinding) restoreAttachedState(context, values[21]);
748     }
749 }
750
751
Popular Tags