View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.internal.component.Properties;
4   import javax.el.ValueExpression;
5   import org.apache.commons.logging.Log;
6   import java.util.HashSet;
7   import org.apache.commons.logging.LogFactory;
8   import java.util.Arrays;
9   import java.util.Set;
10  import org.rcfaces.core.component.capability.IForCapability;
11  import org.rcfaces.core.component.AbstractBasicComponent;
12  import org.rcfaces.core.component.capability.IPagerMessageCapability;
13  
14  /**
15   * <p>The pager Component is linked to the <a href="/comps/dataGridComponent.html">dataGrid Component</a>.
16   * It shows informations about the result set (ex: number of available pages)
17   * and can give direct access to a specific page ("a la Google").</p>
18   * <p>The pager Component has the following capabilities :
19   * <ul>
20   * <li>IRequiredCapability</li>
21   * <li>IAutoTabCapability</li>
22   * <li>IValueChangeEventCapability</li>
23   * <li>IFocusStyleClassCapability</li>
24   * <li>ISelectionEventCapability</li>
25   * <li>IReadOnlyCapability</li>
26   * <li>INumberFormatTypeCapability</li>
27   * <li>ILiteralLocaleCapability</li>
28   * <li>IComponentLocaleCapability</li>
29   * <li>ISeverityStyleClassCapability</li>
30   * <li>IAlternateTextCapability</li>
31   * <li>IValidationParameters</li>
32   * </ul>
33   * </p>
34   * 
35   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/PagerComponent.html">pager</a> renderer is linked to the <a href="/jsdocs/index.html?f_pager.html" target="_blank">f_pager</a> javascript class. f_pager extends f_component, fa_pager</p>
36   * 
37   * <p> Table of component style classes: </p>
38   * <table border="1" cellpadding="3" cellspacing="0" width="100%">
39   * <tbody>
40   * 
41   * <tr style="text-align:left">
42   * <th  width="33%">Style Name</th>
43   * <th width="50%">Description</th>
44   * </tr>
45   * 
46   * <tr  style="text-align:left">
47   * <td width="33%">f_pager</td>
48   * <td width="50%">Defines styles for the wrapper DIV element</td>
49   * </tr>
50   * 
51   * <tr  style="text-align:left">
52   * <td width="33%">f_pager_button_first</td>
53   * <td width="50%">Defines styles for the wrapper SPAN element</td>
54   * </tr>
55   * <tr  style="text-align:left">
56   * <td width="33%">f_pager_button_next</td>
57   * <td width="50%">Defines styles for the wrapper SPAN element</td>
58   * </tr>
59   * <tr  style="text-align:left">
60   * <td width="33%">f_pager_button_last</td>
61   * <td width="50%">Defines styles for the wrapper SPAN element</td>
62   * </tr>
63   * <tr  style="text-align:left">
64   * <td width="33%">f_pager_button_prev</td>
65   * <td width="50%">Defines styles for the wrapper SPAN element</td>
66   * </tr>
67   * 
68   * </tbody>
69   * </table>
70   */
71  public class PagerComponent extends AbstractBasicComponent implements 
72  	IForCapability,
73  	IPagerMessageCapability {
74  
75  	private static final Log LOG = LogFactory.getLog(PagerComponent.class);
76  
77  	public static final String COMPONENT_TYPE="org.rcfaces.core.pager";
78  
79  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractBasicComponent.CAMELIA_ATTRIBUTES);
80  	static {
81  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"message","oneResultMessage","for","noPagedMessage","manyResultsMessage","zeroResultMessage"}));
82  	}
83  
84  	public PagerComponent() {
85  		setRendererType(COMPONENT_TYPE);
86  	}
87  
88  	public PagerComponent(String componentId) {
89  		this();
90  		setId(componentId);
91  	}
92  
93  	public java.lang.String getFor() {
94  		return getFor(null);
95  	}
96  
97  	/**
98  	 * See {@link #getFor() getFor()} for more details
99  	 */
100 	public java.lang.String getFor(javax.faces.context.FacesContext facesContext) {
101 		return engine.getStringProperty(Properties.FOR, facesContext);
102 	}
103 
104 	/**
105 	 * Returns <code>true</code> if the attribute "for" is set.
106 	 * @return <code>true</code> if the attribute is set.
107 	 */
108 	public final boolean isForSetted() {
109 		return engine.isPropertySetted(Properties.FOR);
110 	}
111 
112 	public void setFor(java.lang.String forValue) {
113 		engine.setProperty(Properties.FOR, forValue);
114 	}
115 
116 	public java.lang.String getManyResultsMessage() {
117 		return getManyResultsMessage(null);
118 	}
119 
120 	/**
121 	 * See {@link #getManyResultsMessage() getManyResultsMessage()} for more details
122 	 */
123 	public java.lang.String getManyResultsMessage(javax.faces.context.FacesContext facesContext) {
124 		return engine.getStringProperty(Properties.MANY_RESULTS_MESSAGE, facesContext);
125 	}
126 
127 	/**
128 	 * Returns <code>true</code> if the attribute "manyResultsMessage" is set.
129 	 * @return <code>true</code> if the attribute is set.
130 	 */
131 	public final boolean isManyResultsMessageSetted() {
132 		return engine.isPropertySetted(Properties.MANY_RESULTS_MESSAGE);
133 	}
134 
135 	public void setManyResultsMessage(java.lang.String manyResultsMessage) {
136 		engine.setProperty(Properties.MANY_RESULTS_MESSAGE, manyResultsMessage);
137 	}
138 
139 	public java.lang.String getMessage() {
140 		return getMessage(null);
141 	}
142 
143 	/**
144 	 * See {@link #getMessage() getMessage()} for more details
145 	 */
146 	public java.lang.String getMessage(javax.faces.context.FacesContext facesContext) {
147 		return engine.getStringProperty(Properties.MESSAGE, facesContext);
148 	}
149 
150 	/**
151 	 * Returns <code>true</code> if the attribute "message" is set.
152 	 * @return <code>true</code> if the attribute is set.
153 	 */
154 	public final boolean isMessageSetted() {
155 		return engine.isPropertySetted(Properties.MESSAGE);
156 	}
157 
158 	public void setMessage(java.lang.String message) {
159 		engine.setProperty(Properties.MESSAGE, message);
160 	}
161 
162 	public java.lang.String getOneResultMessage() {
163 		return getOneResultMessage(null);
164 	}
165 
166 	/**
167 	 * See {@link #getOneResultMessage() getOneResultMessage()} for more details
168 	 */
169 	public java.lang.String getOneResultMessage(javax.faces.context.FacesContext facesContext) {
170 		return engine.getStringProperty(Properties.ONE_RESULT_MESSAGE, facesContext);
171 	}
172 
173 	/**
174 	 * Returns <code>true</code> if the attribute "oneResultMessage" is set.
175 	 * @return <code>true</code> if the attribute is set.
176 	 */
177 	public final boolean isOneResultMessageSetted() {
178 		return engine.isPropertySetted(Properties.ONE_RESULT_MESSAGE);
179 	}
180 
181 	public void setOneResultMessage(java.lang.String oneResultMessage) {
182 		engine.setProperty(Properties.ONE_RESULT_MESSAGE, oneResultMessage);
183 	}
184 
185 	public java.lang.String getZeroResultMessage() {
186 		return getZeroResultMessage(null);
187 	}
188 
189 	/**
190 	 * See {@link #getZeroResultMessage() getZeroResultMessage()} for more details
191 	 */
192 	public java.lang.String getZeroResultMessage(javax.faces.context.FacesContext facesContext) {
193 		return engine.getStringProperty(Properties.ZERO_RESULT_MESSAGE, facesContext);
194 	}
195 
196 	/**
197 	 * Returns <code>true</code> if the attribute "zeroResultMessage" is set.
198 	 * @return <code>true</code> if the attribute is set.
199 	 */
200 	public final boolean isZeroResultMessageSetted() {
201 		return engine.isPropertySetted(Properties.ZERO_RESULT_MESSAGE);
202 	}
203 
204 	public void setZeroResultMessage(java.lang.String zeroResultMessage) {
205 		engine.setProperty(Properties.ZERO_RESULT_MESSAGE, zeroResultMessage);
206 	}
207 
208 	/**
209 	 * Returns a string specifying the message to display when there is no row to display.
210 	 * @return message
211 	 */
212 	public String getNoPagedMessage() {
213 		return getNoPagedMessage(null);
214 	}
215 
216 	/**
217 	 * Returns a string specifying the message to display when there is no row to display.
218 	 * @return message
219 	 */
220 	public String getNoPagedMessage(javax.faces.context.FacesContext facesContext) {
221 		return engine.getStringProperty(Properties.NO_PAGED_MESSAGE, facesContext);
222 	}
223 
224 	/**
225 	 * Steps a string specifying the message to display when there is no row to display.
226 	 * @param noPagedMessage message
227 	 */
228 	public void setNoPagedMessage(String noPagedMessage) {
229 		engine.setProperty(Properties.NO_PAGED_MESSAGE, noPagedMessage);
230 	}
231 
232 	/**
233 	 * Steps a string specifying the message to display when there is no row to display.
234 	 * @param noPagedMessage message
235 	 */
236 	/**
237 	 * Returns <code>true</code> if the attribute "noPagedMessage" is set.
238 	 * @return <code>true</code> if the attribute is set.
239 	 */
240 	public boolean isNoPagedMessageSetted() {
241 		return engine.isPropertySetted(Properties.NO_PAGED_MESSAGE);
242 	}
243 
244 	protected Set getCameliaFields() {
245 		return CAMELIA_ATTRIBUTES;
246 	}
247 }