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;
23  
24  import javax.el.MethodExpression;
25  import javax.faces.component.UIComponent;
26  import javax.faces.context.FacesContext;
27  import javax.faces.el.MethodBinding;
28  import javax.faces.event.AbortProcessingException;
29  import javax.faces.event.FacesEvent;
30  import javax.faces.event.PhaseId;
31  import org.apache.myfaces.trinidad.bean.FacesBean;
32  import org.apache.myfaces.trinidad.bean.PropertyKey;
33  import org.apache.myfaces.trinidad.event.ChartDrillDownEvent;
34  import org.apache.myfaces.trinidad.event.ChartDrillDownListener;
35  
36  /**
37   *
38   * <html:p>
39   *           The Apache Trinidad Chart is used to display data in a Chart Format.
40   *         </html:p>
41   *
42   * <h4>Events:</h4>
43   * <table border="1" width="100%" cellpadding="3" summary="">
44   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
45   * <th align="left">Type</th>
46   * <th align="left">Phases</th>
47   * <th align="left">Description</th>
48   * </tr>
49   * <tr class="TableRowColor">
50   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
51   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
52   * <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>
53   * </tr>
54   * </table>
55   */
56  public class UIXChart extends UIXComponentBase
57  {
58    static public final FacesBean.Type TYPE = new FacesBean.Type(
59      UIXComponentBase.TYPE);
60    static public final PropertyKey VALUE_KEY =
61      TYPE.registerKey("value", Object.class, null, 0, PropertyKey.Mutable.SOMETIMES);
62    static public final PropertyKey CHART_DRILL_DOWN_LISTENER_KEY =
63      TYPE.registerKey("chartDrillDownListener", MethodExpression.class);
64  
65    static public final String COMPONENT_FAMILY =
66      "org.apache.myfaces.trinidad.Chart";
67    static public final String COMPONENT_TYPE =
68      "org.apache.myfaces.trinidad.Chart";
69  
70    /**
71     * Construct an instance of the UIXChart.
72     */
73    public UIXChart()
74    {
75      super("org.apache.myfaces.trinidad.Chart");
76    }
77    
78    /**
79     * Delivers an event to the appropriate listeners.
80     * @param event
81     * @throws javax.faces.event.AbortProcessingException
82     */
83    @Override
84    public void broadcast(FacesEvent event)
85      throws AbortProcessingException
86    {
87  
88      // Deliver to the default ChartDrillDownEvent
89      if (event instanceof ChartDrillDownEvent)
90      {
91        broadcastToMethodExpression(event, getChartDrillDownListener());
92      }
93      super.broadcast(event);
94    }
95  
96    /**
97     * Adds a drilldown listener.
98     *
99     * @param listener  the selection listener to add
100    */
101   final public void addChartDrillDownListener(
102     ChartDrillDownListener listener)
103   {
104     addFacesListener(listener);
105   }
106 
107   /**
108    * Removes a drilldown listener.
109    *
110    * @param listener  the selection listener to remove
111    */
112   final public void removeChartDrillDownListener(
113     ChartDrillDownListener listener)
114   {
115     removeFacesListener(listener);
116   }
117 
118 
119   /**
120    * Gets the data model being used by this component.The specific model class must be derived from 
121    *         <code>org.apache.myfaces.trinidad.model.ChartModel</code>. 
122    *         The derived class must override the abstract methods to provide the required values for chart display.
123    *
124    * @return  the new value value
125    */
126   final public Object getValue()
127   {
128     return getProperty(VALUE_KEY);
129   }
130 
131   /**
132    * Sets the data model being used by this component.The specific model class must be derived from 
133    *         <code>org.apache.myfaces.trinidad.model.ChartModel</code>. 
134    *         The derived class must override the abstract methods to provide the required values for chart display.
135    * 
136    * @param value  the new value value
137    */
138   final public void setValue(Object value)
139   {
140     setProperty(VALUE_KEY, (value));
141   }
142 
143   /**
144    * Gets a method reference to a drill down listener that
145    *          will be called when the user drills down into the chart data.The method must take a parameter of type <code>org.apache.myfaces.trinidad.event.ChartDrillDownEvent</code>.
146    *
147    * @return  the new chartDrillDownListener value
148    */
149   final public MethodExpression getChartDrillDownListener()
150   {
151     return (MethodExpression)getProperty(CHART_DRILL_DOWN_LISTENER_KEY);
152   }
153 
154   /**
155    * Sets a method reference to a drill down listener that
156    *          will be called when the user drills down into the chart data.The method must take a parameter of type <code>org.apache.myfaces.trinidad.event.ChartDrillDownEvent</code>.
157    * 
158    * @param chartDrillDownListener  the new chartDrillDownListener value
159    */
160   final public void setChartDrillDownListener(MethodExpression chartDrillDownListener)
161   {
162     setProperty(CHART_DRILL_DOWN_LISTENER_KEY, (chartDrillDownListener));
163   }
164 
165   @Override
166   public String getFamily()
167   {
168     return COMPONENT_FAMILY;
169   }
170 
171   @Override
172   protected FacesBean.Type getBeanType()
173   {
174     return TYPE;
175   }
176 
177   /**
178    * Construct an instance of the UIXChart.
179    */
180   protected UIXChart(
181     String rendererType
182     )
183   {
184     super(rendererType);
185   }
186 
187   static
188   {
189     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Chart","org.apache.myfaces.trinidad.Chart");
190   }
191 }