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;
23
24 import org.apache.myfaces.trinidad.bean.FacesBean;
25 import org.apache.myfaces.trinidad.bean.PropertyKey;
26 import org.apache.myfaces.trinidad.component.UIXPoll;
27 import org.apache.myfaces.trinidad.util.ComponentUtils;
28
29 /**
30 *
31 * <html:p>
32 * The poll element triggers an event after the time interval
33 * specified by the interval attribute (in milliseconds).
34 * On the server, the <code>org.apache.myfaces.trinidad.event.PollEvent</code>
35 * is queued and the listeners get a chance to update the model,
36 * refresh components, or even display a dialog in response to
37 * this event. The components that have listed this poll
38 * component as a partiaTrigger get a chance to re-render themselves.
39 * The poll component automatically uses Partial Page Rendering
40 * (PPR) if available.
41 * </html:p>
42 *
43 * <h4>Events:</h4>
44 * <table border="1" width="100%" cellpadding="3" summary="">
45 * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
46 * <th align="left">Type</th>
47 * <th align="left">Phases</th>
48 * <th align="left">Description</th>
49 * </tr>
50 * <tr class="TableRowColor">
51 * <td valign="top"><code>org.apache.myfaces.trinidad.event.PollEvent</code></td>
52 * <td valign="top" nowrap>Apply<br>Request<br>Values<br>Invoke<br>Application</td>
53 * <td valign="top">Event delivered when the poll component polls the server.</td>
54 * </tr>
55 * <tr class="TableRowColor">
56 * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
57 * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
58 * <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>
59 * </tr>
60 * </table>
61 */
62 public class CorePoll extends UIXPoll
63 {
64 static public final FacesBean.Type TYPE = new FacesBean.Type(
65 UIXPoll.TYPE);
66 static public final PropertyKey INTERVAL_KEY =
67 TYPE.registerKey("interval", Integer.class, Integer.valueOf(5000));
68
69 static public final String COMPONENT_FAMILY =
70 "org.apache.myfaces.trinidad.Poll";
71 static public final String COMPONENT_TYPE =
72 "org.apache.myfaces.trinidad.CorePoll";
73
74 /**
75 * Construct an instance of the CorePoll.
76 */
77 public CorePoll()
78 {
79 super("org.apache.myfaces.trinidad.Poll");
80 }
81
82 /**
83 * Gets the time between poll events, in milliseconds.
84 * The default is 5000. If in screen-reader mode,
85 * make sure the interval is long enough for the
86 * screen reader to read through the re-render before a
87 * new poll occurs.
88 *
89 * @return the new interval value
90 */
91 final public int getInterval()
92 {
93 return ComponentUtils.resolveInteger(getProperty(INTERVAL_KEY), 5000);
94 }
95
96 /**
97 * Sets the time between poll events, in milliseconds.
98 * The default is 5000. If in screen-reader mode,
99 * make sure the interval is long enough for the
100 * screen reader to read through the re-render before a
101 * new poll occurs.
102 *
103 * @param interval the new interval value
104 */
105 final public void setInterval(int interval)
106 {
107 setProperty(INTERVAL_KEY, Integer.valueOf(interval));
108 }
109
110 @Override
111 public String getFamily()
112 {
113 return COMPONENT_FAMILY;
114 }
115
116 @Override
117 protected FacesBean.Type getBeanType()
118 {
119 return TYPE;
120 }
121
122 /**
123 * Construct an instance of the CorePoll.
124 */
125 protected CorePoll(
126 String rendererType
127 )
128 {
129 super(rendererType);
130 }
131
132 static
133 {
134 TYPE.lockAndRegister("org.apache.myfaces.trinidad.Poll","org.apache.myfaces.trinidad.Poll");
135 }
136 }