View Javadoc

1   // WARNING: This file was automatically generated. Do not edit it directly,
2   //          or you will lose your changes.
3   
4   /*
5    * Licensed to the Apache Software Foundation (ASF) under one
6    * or more contributor license agreements.  See the NOTICE file
7    * distributed with this work for additional information
8    * regarding copyright ownership.  The ASF licenses this file
9    * to you under the Apache License, Version 2.0 (the
10   * "License"); you may not use this file except in compliance
11   * with the License.  You may obtain a copy of the License at
12   *
13   *   http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing,
16   * software distributed under the License is distributed on an
17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18   * KIND, either express or implied.  See the License for the
19   * specific language governing permissions and limitations
20   * under the License.
21  */
22  package org.apache.myfaces.trinidad.component.core.data;
23  
24  import org.apache.myfaces.trinidad.bean.FacesBean;
25  import org.apache.myfaces.trinidad.bean.PropertyKey;
26  import org.apache.myfaces.trinidad.component.UIXChart;
27  import org.apache.myfaces.trinidad.util.ComponentUtils;
28  
29  /**
30   *
31   * <html:p>
32   *           The Trinidad Chart is used to display data as a chart.
33   *         </html:p>
34   *
35   * <h4>Events:</h4>
36   * <table border="1" width="100%" cellpadding="3" summary="">
37   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
38   * <th align="left">Type</th>
39   * <th align="left">Phases</th>
40   * <th align="left">Description</th>
41   * </tr>
42   * <tr class="TableRowColor">
43   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
44   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
45   * <td valign="top">Event delivered to describe an attribute change.  Attribute change events are not delivered for any programmatic change to a property.  They are only delivered when a renderer changes a property without the application's specific request.  An example of an attribute change event might include the width of a column that supported client-side resizing.</td>
46   * </tr>
47   * </table>
48   */
49  public class CoreChart extends UIXChart
50  {
51    static public final String TYPE_VERTICAL_BAR = "verticalBar";
52    static public final String TYPE_HORIZONTAL_BAR = "horizontalBar";
53    static public final String TYPE_STACKED_VERTICAL_BAR = "stackedVerticalBar";
54    static public final String TYPE_STACKED_HORIZONTAL_BAR = "stackedHorizontalBar";
55    static public final String TYPE_PIE = "pie";
56    static public final String TYPE_AREA = "area";
57    static public final String TYPE_STACKED_AREA = "stackedArea";
58    static public final String TYPE_LINE = "line";
59    static public final String TYPE_BAR_LINE = "barLine";
60    static public final String TYPE_XYLINE = "XYLine";
61    static public final String TYPE_SCATTER_PLOT = "scatterPlot";
62    static public final String TYPE_RADAR = "radar";
63    static public final String TYPE_RADAR_AREA = "radarArea";
64    static public final String TYPE_FUNNEL = "funnel";
65    static public final String TYPE_CIRCULAR_GAUGE = "circularGauge";
66    static public final String TYPE_SEMI_CIRCULAR_GAUGE = "semiCircularGauge";
67    static public final String LEGEND_POSITION_NONE = "none";
68    static public final String LEGEND_POSITION_BOTTOM = "bottom";
69    static public final String LEGEND_POSITION_END = "end";
70    static public final String LEGEND_POSITION_TOP = "top";
71    static public final String LEGEND_POSITION_START = "start";
72    static public final FacesBean.Type TYPE = new FacesBean.Type(
73      UIXChart.TYPE);
74    static public final PropertyKey INLINE_STYLE_KEY =
75      TYPE.registerKey("inlineStyle", String.class);
76    static public final PropertyKey STYLE_CLASS_KEY =
77      TYPE.registerKey("styleClass", String.class);
78    static public final PropertyKey SHORT_DESC_KEY =
79      TYPE.registerKey("shortDesc", String.class);
80    static public final PropertyKey PARTIAL_TRIGGERS_KEY =
81      TYPE.registerKey("partialTriggers", String[].class, null, 0, PropertyKey.Mutable.RARELY);
82    static public final PropertyKey TYPE_KEY =
83      TYPE.registerKey("type", String.class, "verticalBar");
84    static public final PropertyKey TEMPLATE_SOURCE_KEY =
85      TYPE.registerKey("templateSource", String.class);
86    static public final PropertyKey PERSPECTIVE_KEY =
87      TYPE.registerKey("perspective", Boolean.class, Boolean.TRUE);
88    static public final PropertyKey LEGEND_POSITION_KEY =
89      TYPE.registerKey("legendPosition", String.class, "bottom");
90    static public final PropertyKey ANIMATION_DURATION_KEY =
91      TYPE.registerKey("animationDuration", Integer.class, Integer.valueOf(1000));
92    static public final PropertyKey YMAJOR_GRID_LINE_COUNT_KEY =
93      TYPE.registerKey("YMajorGridLineCount", Integer.class, Integer.valueOf(3));
94    static public final PropertyKey YMINOR_GRID_LINE_COUNT_KEY =
95      TYPE.registerKey("YMinorGridLineCount", Integer.class, Integer.valueOf(-1));
96    static public final PropertyKey XMAJOR_GRID_LINE_COUNT_KEY =
97      TYPE.registerKey("XMajorGridLineCount", Integer.class, Integer.valueOf(-1));
98    static public final PropertyKey MAX_PRECISION_KEY =
99      TYPE.registerKey("maxPrecision", Integer.class, Integer.valueOf(0));
100   static public final PropertyKey GRADIENTS_USED_KEY =
101     TYPE.registerKey("gradientsUsed", Boolean.class, Boolean.TRUE);
102   static public final PropertyKey TOOLTIPS_VISIBLE_KEY =
103     TYPE.registerKey("tooltipsVisible", Boolean.class, Boolean.TRUE);
104 
105   static public final String COMPONENT_FAMILY =
106     "org.apache.myfaces.trinidad.Chart";
107   static public final String COMPONENT_TYPE =
108     "org.apache.myfaces.trinidad.CoreChart";
109 
110   /**
111    * Construct an instance of the CoreChart.
112    */
113   public CoreChart()
114   {
115     super("org.apache.myfaces.trinidad.Chart");
116   }
117 
118   /**
119    * Gets the CSS styles to use for this component.
120    *
121    * @return  the new inlineStyle value
122    */
123   final public String getInlineStyle()
124   {
125     return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
126   }
127 
128   /**
129    * Sets the CSS styles to use for this component.
130    * 
131    * @param inlineStyle  the new inlineStyle value
132    */
133   final public void setInlineStyle(String inlineStyle)
134   {
135     setProperty(INLINE_STYLE_KEY, (inlineStyle));
136   }
137 
138   /**
139    * Gets a CSS style class to use for this component.
140    *
141    * @return  the new styleClass value
142    */
143   final public String getStyleClass()
144   {
145     return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
146   }
147 
148   /**
149    * Sets a CSS style class to use for this component.
150    * 
151    * @param styleClass  the new styleClass value
152    */
153   final public void setStyleClass(String styleClass)
154   {
155     setProperty(STYLE_CLASS_KEY, (styleClass));
156   }
157 
158   /**
159    * Gets The short description of the component. This text is commonly used by user agents to display tooltip help text.
160    *
161    * @return  the new shortDesc value
162    */
163   final public String getShortDesc()
164   {
165     return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
166   }
167 
168   /**
169    * Sets The short description of the component. This text is commonly used by user agents to display tooltip help text.
170    * 
171    * @param shortDesc  the new shortDesc value
172    */
173   final public void setShortDesc(String shortDesc)
174   {
175     setProperty(SHORT_DESC_KEY, (shortDesc));
176   }
177 
178   /**
179    * Gets the IDs of the components that should trigger a partial update.
180    *         <p>
181    *         This component will listen on the trigger components. If one of the
182    *         trigger components receives an event that will cause it to update
183    *         in some way, this component will request to be updated too.</p>
184    *         <p>
185    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
186    *         </p>
187    *         <p>
188    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
189    *         or use multiple colons to move up through the NamingContainer. For example,
190    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
191    *         ":::" will pop out of two naming containers, etc. The search for
192    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
193    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
194    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
195    *
196    * @return  the new partialTriggers value
197    */
198   final public String[] getPartialTriggers()
199   {
200     return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
201   }
202 
203   /**
204    * Sets the IDs of the components that should trigger a partial update.
205    *         <p>
206    *         This component will listen on the trigger components. If one of the
207    *         trigger components receives an event that will cause it to update
208    *         in some way, this component will request to be updated too.</p>
209    *         <p>
210    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
211    *         </p>
212    *         <p>
213    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
214    *         or use multiple colons to move up through the NamingContainer. For example,
215    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
216    *         ":::" will pop out of two naming containers, etc. The search for
217    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
218    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
219    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
220    * 
221    * @param partialTriggers  the new partialTriggers value
222    */
223   final public void setPartialTriggers(String[] partialTriggers)
224   {
225     setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
226   }
227 
228   /**
229    * Gets The type of chart. Possible Values are: verticalBar horizontalBar stackedVerticalBar stackedHorizontalBar pie area stackedArea line barLine XYLine scatterPlot radar radarArea funnel circularGauge semiCircularGauge.
230    *
231    * @return  the new type value
232    */
233   final public String getType()
234   {
235     return ComponentUtils.resolveString(getProperty(TYPE_KEY), "verticalBar");
236   }
237 
238   /**
239    * Sets The type of chart. Possible Values are: verticalBar horizontalBar stackedVerticalBar stackedHorizontalBar pie area stackedArea line barLine XYLine scatterPlot radar radarArea funnel circularGauge semiCircularGauge.
240    * 
241    * @param type  the new type value
242    */
243   final public void setType(String type)
244   {
245     setProperty(TYPE_KEY, (type));
246   }
247 
248   /**
249    * Gets Specifies URI for the template document from which the chart elements are cloned.
250    *         If this attribute is null, the chart component uses a default template. The default template is chosen based
251    *         on whether the useGradient attribute is true or false.
252    *         The template document is useful for changing the Look and Feel of the chart.
253    *         Some examples include:1)A developer may want to skin the chart to match its corporate Look and Feel.
254    *         2)A developer may want to put water marks/background images inside the chart.
255    *         3)A developer may want to change the template for the gauges used in the gauge charts.
256    *         4)A developer may want to turn off gradients and instead use filters to set some interesting effects on the chart elements.
257    *
258    * @return  the new templateSource value
259    */
260   final public String getTemplateSource()
261   {
262     return ComponentUtils.resolveString(getProperty(TEMPLATE_SOURCE_KEY));
263   }
264 
265   /**
266    * Sets Specifies URI for the template document from which the chart elements are cloned.
267    *         If this attribute is null, the chart component uses a default template. The default template is chosen based
268    *         on whether the useGradient attribute is true or false.
269    *         The template document is useful for changing the Look and Feel of the chart.
270    *         Some examples include:1)A developer may want to skin the chart to match its corporate Look and Feel.
271    *         2)A developer may want to put water marks/background images inside the chart.
272    *         3)A developer may want to change the template for the gauges used in the gauge charts.
273    *         4)A developer may want to turn off gradients and instead use filters to set some interesting effects on the chart elements.
274    * 
275    * @param templateSource  the new templateSource value
276    */
277   final public void setTemplateSource(String templateSource)
278   {
279     setProperty(TEMPLATE_SOURCE_KEY, (templateSource));
280   }
281 
282   /**
283    * Gets Specifies if the chart is drawn with a perspective (2.5D).
284    *       By default the chart is draw with a perspective.
285    *
286    * @return  the new perspective value
287    */
288   final public boolean isPerspective()
289   {
290     return ComponentUtils.resolveBoolean(getProperty(PERSPECTIVE_KEY), true);
291   }
292 
293   /**
294    * Sets Specifies if the chart is drawn with a perspective (2.5D).
295    *       By default the chart is draw with a perspective.
296    * 
297    * @param perspective  the new perspective value
298    */
299   final public void setPerspective(boolean perspective)
300   {
301     setProperty(PERSPECTIVE_KEY, perspective ? Boolean.TRUE : Boolean.FALSE);
302   }
303 
304   /**
305    * Gets Specified the location of the legend. The legend can be turned off by setting this attribute to none.
306    *       Otherwise it can be drawn at top, start, end or bottom.
307    *
308    * @return  the new legendPosition value
309    */
310   final public String getLegendPosition()
311   {
312     return ComponentUtils.resolveString(getProperty(LEGEND_POSITION_KEY), "bottom");
313   }
314 
315   /**
316    * Sets Specified the location of the legend. The legend can be turned off by setting this attribute to none.
317    *       Otherwise it can be drawn at top, start, end or bottom.
318    * 
319    * @param legendPosition  the new legendPosition value
320    */
321   final public void setLegendPosition(String legendPosition)
322   {
323     setProperty(LEGEND_POSITION_KEY, (legendPosition));
324   }
325 
326   /**
327    * Gets The duration of the animation for the chart components in milliseconds.
328    *       Animation can be turned off if the animationDuration is set to 0. The default value is 1000ms.
329    *
330    * @return  the new animationDuration value
331    */
332   final public int getAnimationDuration()
333   {
334     return ComponentUtils.resolveInteger(getProperty(ANIMATION_DURATION_KEY), 1000);
335   }
336 
337   /**
338    * Sets The duration of the animation for the chart components in milliseconds.
339    *       Animation can be turned off if the animationDuration is set to 0. The default value is 1000ms.
340    * 
341    * @param animationDuration  the new animationDuration value
342    */
343   final public void setAnimationDuration(int animationDuration)
344   {
345     setProperty(ANIMATION_DURATION_KEY, Integer.valueOf(animationDuration));
346   }
347 
348   /**
349    * Gets This attribute controls the number of horizontal major grid lines displayed in the chart.
350    *       For horizontal charts(horizontalBar, stackedHorizontalBar) this attribute controls the horizontal major grid lines.
351    *       The default is 3.
352    *
353    * @return  the new YMajorGridLineCount value
354    */
355   final public int getYMajorGridLineCount()
356   {
357     return ComponentUtils.resolveInteger(getProperty(YMAJOR_GRID_LINE_COUNT_KEY), 3);
358   }
359 
360   /**
361    * Sets This attribute controls the number of horizontal major grid lines displayed in the chart.
362    *       For horizontal charts(horizontalBar, stackedHorizontalBar) this attribute controls the horizontal major grid lines.
363    *       The default is 3.
364    * 
365    * @param YMajorGridLineCount  the new YMajorGridLineCount value
366    */
367   final public void setYMajorGridLineCount(int YMajorGridLineCount)
368   {
369     setProperty(YMAJOR_GRID_LINE_COUNT_KEY, Integer.valueOf(YMajorGridLineCount));
370   }
371 
372   /**
373    * Gets This attribute controls the number of minor grid lines displayed within a major grid section.
374    *       The default value is -1, which means it varies per chart type. Currently it is used only for gauge charts
375    *       with a default of 3.
376    *
377    * @return  the new YMinorGridLineCount value
378    */
379   final public int getYMinorGridLineCount()
380   {
381     return ComponentUtils.resolveInteger(getProperty(YMINOR_GRID_LINE_COUNT_KEY), -1);
382   }
383 
384   /**
385    * Sets This attribute controls the number of minor grid lines displayed within a major grid section.
386    *       The default value is -1, which means it varies per chart type. Currently it is used only for gauge charts
387    *       with a default of 3.
388    * 
389    * @param YMinorGridLineCount  the new YMinorGridLineCount value
390    */
391   final public void setYMinorGridLineCount(int YMinorGridLineCount)
392   {
393     setProperty(YMINOR_GRID_LINE_COUNT_KEY, Integer.valueOf(YMinorGridLineCount));
394   }
395 
396   /**
397    * Gets This attribute controls the number of vertical major grid lines displayed in the chart.
398    *       The default value is -1, which implies that the vertical major grid lines are controlled by the groupLabels
399    *       in the chart model. This parameter along with the groupLabels provide flexibility in labeling the
400    *       groups. For e.g. one can display a vertical bar chart with 2 years data. Only quarters may be labeled and XMajorGridLineCount can
401    *       be 1 for splitting the data into two sections.
402    *
403    * @return  the new XMajorGridLineCount value
404    */
405   final public int getXMajorGridLineCount()
406   {
407     return ComponentUtils.resolveInteger(getProperty(XMAJOR_GRID_LINE_COUNT_KEY), -1);
408   }
409 
410   /**
411    * Sets This attribute controls the number of vertical major grid lines displayed in the chart.
412    *       The default value is -1, which implies that the vertical major grid lines are controlled by the groupLabels
413    *       in the chart model. This parameter along with the groupLabels provide flexibility in labeling the
414    *       groups. For e.g. one can display a vertical bar chart with 2 years data. Only quarters may be labeled and XMajorGridLineCount can
415    *       be 1 for splitting the data into two sections.
416    * 
417    * @param XMajorGridLineCount  the new XMajorGridLineCount value
418    */
419   final public void setXMajorGridLineCount(int XMajorGridLineCount)
420   {
421     setProperty(XMAJOR_GRID_LINE_COUNT_KEY, Integer.valueOf(XMajorGridLineCount));
422   }
423 
424   /**
425    * Gets The maximum precision of the numbers displayed on the yAxis(xAxis for horizontal charts).
426    *       The default is 0.
427    *
428    * @return  the new maxPrecision value
429    */
430   final public int getMaxPrecision()
431   {
432     return ComponentUtils.resolveInteger(getProperty(MAX_PRECISION_KEY), 0);
433   }
434 
435   /**
436    * Sets The maximum precision of the numbers displayed on the yAxis(xAxis for horizontal charts).
437    *       The default is 0.
438    * 
439    * @param maxPrecision  the new maxPrecision value
440    */
441   final public void setMaxPrecision(int maxPrecision)
442   {
443     setProperty(MAX_PRECISION_KEY, Integer.valueOf(maxPrecision));
444   }
445 
446   /**
447    * Gets Specifies if gradients are used to display chart elements.
448    *       By default the chart elements use gradients.
449    *
450    * @return  the new gradientsUsed value
451    */
452   final public boolean isGradientsUsed()
453   {
454     return ComponentUtils.resolveBoolean(getProperty(GRADIENTS_USED_KEY), true);
455   }
456 
457   /**
458    * Sets Specifies if gradients are used to display chart elements.
459    *       By default the chart elements use gradients.
460    * 
461    * @param gradientsUsed  the new gradientsUsed value
462    */
463   final public void setGradientsUsed(boolean gradientsUsed)
464   {
465     setProperty(GRADIENTS_USED_KEY, gradientsUsed ? Boolean.TRUE : Boolean.FALSE);
466   }
467 
468   /**
469    * Gets Specifies if tooltips are displayed or not.
470    *
471    * @return  the new tooltipsVisible value
472    */
473   final public boolean isTooltipsVisible()
474   {
475     return ComponentUtils.resolveBoolean(getProperty(TOOLTIPS_VISIBLE_KEY), true);
476   }
477 
478   /**
479    * Sets Specifies if tooltips are displayed or not.
480    * 
481    * @param tooltipsVisible  the new tooltipsVisible value
482    */
483   final public void setTooltipsVisible(boolean tooltipsVisible)
484   {
485     setProperty(TOOLTIPS_VISIBLE_KEY, tooltipsVisible ? Boolean.TRUE : Boolean.FALSE);
486   }
487 
488   @Override
489   public String getFamily()
490   {
491     return COMPONENT_FAMILY;
492   }
493 
494   @Override
495   protected FacesBean.Type getBeanType()
496   {
497     return TYPE;
498   }
499 
500   /**
501    * Construct an instance of the CoreChart.
502    */
503   protected CoreChart(
504     String rendererType
505     )
506   {
507     super(rendererType);
508   }
509 
510   static
511   {
512     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Chart","org.apache.myfaces.trinidad.Chart");
513   }
514 }