View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.component.iterator.IMenuIterator;
4   import org.rcfaces.core.component.capability.IScrollableCapability;
5   import org.rcfaces.core.internal.component.Properties;
6   import org.apache.commons.logging.LogFactory;
7   import java.lang.String;
8   import org.rcfaces.core.internal.tools.MenuTools;
9   import org.rcfaces.core.component.capability.IBorderCapability;
10  import org.rcfaces.core.component.AbstractDataComponent;
11  import org.rcfaces.core.component.capability.IShowValueCapability;
12  import org.rcfaces.core.component.capability.IBorderTypeCapability;
13  import org.rcfaces.core.component.IMenuComponent;
14  import javax.el.ValueExpression;
15  import java.util.HashSet;
16  import org.apache.commons.logging.Log;
17  import java.util.Set;
18  import java.util.Arrays;
19  import org.rcfaces.core.component.capability.IMenuCapability;
20  
21  /**
22   * <p>The componentslist component Shows the components for each data with pagination.</p>
23   * <p>The componentslist Component has the following capabilities :
24   * <ul>
25   * <li>IMenuCapability</li>
26   * <li>IBorderCapability</li>
27   * <li>IBorderTypeCapability</li>
28   * <li>IScrollableCapability</li>
29   * <li>IShowValueCapability </li>
30   * </ul>
31   * </p>
32   * 
33   * 
34   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/ComponentsListComponent.html"> componentsList </a> renderer is link to the <a href="/jsdocs/index.html?f_componentsGrid.html" target="_blank">f_componentslist</a> javascript class. f_componentslist extends f_component, fa_pagedComponent</p>
35   * 
36   * <p> Table of component style classes: </p>
37   * <table border="1" cellpadding="3" cellspacing="0" width="100%">
38   * <tbody>
39   * 
40   * <tr style="text-align:left">
41   * <th  width="33%">Style Name</th>
42   * <th width="50%">Description</th>
43   * </tr>
44   * 
45   * <tr  style="text-align:left">
46   * <td width="33%">f_componentslist</td>
47   * <td id="ermvsh" width="50%">Defines styles for the wrapper DIV element. Contains a Table</td>
48   * </tr>
49   * <tr  style="text-align:left">
50   * <td width="33%">f_componentslist_cell</td>
51   * <td id="ermvsh" width="50%">Defines styles for the wrapper TD element for the row.</td>
52   * </tr>
53   * </tbody>
54   * </table>
55   */
56  public class ComponentsListComponent extends AbstractDataComponent implements 
57  	IMenuCapability,
58  	IBorderCapability,
59  	IBorderTypeCapability,
60  	IScrollableCapability,
61  	IShowValueCapability {
62  
63  	private static final Log LOG = LogFactory.getLog(ComponentsListComponent.class);
64  
65  	public static final String COMPONENT_TYPE="org.rcfaces.core.componentsList";
66  
67  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractDataComponent.CAMELIA_ATTRIBUTES);
68  	static {
69  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"showValue","columnStyleClass","verticalScrollPosition","borderType","horizontalScrollPosition","rowStyleClass","rowCountVar","border","rowIndexVar","columnNumber"}));
70  	}
71  
72  	public ComponentsListComponent() {
73  		setRendererType(COMPONENT_TYPE);
74  	}
75  
76  	public ComponentsListComponent(String componentId) {
77  		this();
78  		setId(componentId);
79  	}
80  
81  	public IMenuComponent getMenu() {
82  
83  
84  		return MenuTools.getMenu(this);
85  		
86  	}
87  
88  	public IMenuComponent getMenu(String menuId) {
89  
90  
91  		return MenuTools.getMenu(this, menuId);
92  		
93  	}
94  
95  	public IMenuIterator listMenus() {
96  
97  
98  		return MenuTools.listMenus(this);
99  		
100 	}
101 
102 	public boolean isBorder() {
103 		return isBorder(null);
104 	}
105 
106 	/**
107 	 * See {@link #isBorder() isBorder()} for more details
108 	 */
109 	public boolean isBorder(javax.faces.context.FacesContext facesContext) {
110 		return engine.getBoolProperty(Properties.BORDER, true, facesContext);
111 	}
112 
113 	/**
114 	 * Returns <code>true</code> if the attribute "border" is set.
115 	 * @return <code>true</code> if the attribute is set.
116 	 */
117 	public final boolean isBorderSetted() {
118 		return engine.isPropertySetted(Properties.BORDER);
119 	}
120 
121 	public void setBorder(boolean border) {
122 		engine.setProperty(Properties.BORDER, border);
123 	}
124 
125 	public java.lang.String getBorderType() {
126 		return getBorderType(null);
127 	}
128 
129 	/**
130 	 * See {@link #getBorderType() getBorderType()} for more details
131 	 */
132 	public java.lang.String getBorderType(javax.faces.context.FacesContext facesContext) {
133 		return engine.getStringProperty(Properties.BORDER_TYPE, facesContext);
134 	}
135 
136 	/**
137 	 * Returns <code>true</code> if the attribute "borderType" is set.
138 	 * @return <code>true</code> if the attribute is set.
139 	 */
140 	public final boolean isBorderTypeSetted() {
141 		return engine.isPropertySetted(Properties.BORDER_TYPE);
142 	}
143 
144 	public void setBorderType(java.lang.String borderType) {
145 		engine.setProperty(Properties.BORDER_TYPE, borderType);
146 	}
147 
148 	public int getHorizontalScrollPosition() {
149 		return getHorizontalScrollPosition(null);
150 	}
151 
152 	/**
153 	 * See {@link #getHorizontalScrollPosition() getHorizontalScrollPosition()} for more details
154 	 */
155 	public int getHorizontalScrollPosition(javax.faces.context.FacesContext facesContext) {
156 		return engine.getIntProperty(Properties.HORIZONTAL_SCROLL_POSITION,0, facesContext);
157 	}
158 
159 	/**
160 	 * Returns <code>true</code> if the attribute "horizontalScrollPosition" is set.
161 	 * @return <code>true</code> if the attribute is set.
162 	 */
163 	public final boolean isHorizontalScrollPositionSetted() {
164 		return engine.isPropertySetted(Properties.HORIZONTAL_SCROLL_POSITION);
165 	}
166 
167 	public void setHorizontalScrollPosition(int horizontalScrollPosition) {
168 		engine.setProperty(Properties.HORIZONTAL_SCROLL_POSITION, horizontalScrollPosition);
169 	}
170 
171 	public int getVerticalScrollPosition() {
172 		return getVerticalScrollPosition(null);
173 	}
174 
175 	/**
176 	 * See {@link #getVerticalScrollPosition() getVerticalScrollPosition()} for more details
177 	 */
178 	public int getVerticalScrollPosition(javax.faces.context.FacesContext facesContext) {
179 		return engine.getIntProperty(Properties.VERTICAL_SCROLL_POSITION,0, facesContext);
180 	}
181 
182 	/**
183 	 * Returns <code>true</code> if the attribute "verticalScrollPosition" is set.
184 	 * @return <code>true</code> if the attribute is set.
185 	 */
186 	public final boolean isVerticalScrollPositionSetted() {
187 		return engine.isPropertySetted(Properties.VERTICAL_SCROLL_POSITION);
188 	}
189 
190 	public void setVerticalScrollPosition(int verticalScrollPosition) {
191 		engine.setProperty(Properties.VERTICAL_SCROLL_POSITION, verticalScrollPosition);
192 	}
193 
194 	public java.lang.Object getShowValue() {
195 		return getShowValue(null);
196 	}
197 
198 	/**
199 	 * See {@link #getShowValue() getShowValue()} for more details
200 	 */
201 	public java.lang.Object getShowValue(javax.faces.context.FacesContext facesContext) {
202 		return engine.getProperty(Properties.SHOW_VALUE, facesContext);
203 	}
204 
205 	/**
206 	 * Returns <code>true</code> if the attribute "showValue" is set.
207 	 * @return <code>true</code> if the attribute is set.
208 	 */
209 	public final boolean isShowValueSetted() {
210 		return engine.isPropertySetted(Properties.SHOW_VALUE);
211 	}
212 
213 	public void setShowValue(java.lang.Object showValue) {
214 		engine.setProperty(Properties.SHOW_VALUE, showValue);
215 	}
216 
217 	/**
218 	 * Returns a string value specifying the name of the variable receiving the number of rows.
219 	 * @return variable name
220 	 */
221 	public String getRowCountVar() {
222 		return getRowCountVar(null);
223 	}
224 
225 	/**
226 	 * Returns a string value specifying the name of the variable receiving the number of rows.
227 	 * @return variable name
228 	 */
229 	public String getRowCountVar(javax.faces.context.FacesContext facesContext) {
230 		return engine.getStringProperty(Properties.ROW_COUNT_VAR, facesContext);
231 	}
232 
233 	/**
234 	 * Sets a string value specifying the name of the variable receiving the number of rows.
235 	 * @param rowCountVar variable name
236 	 */
237 	public void setRowCountVar(String rowCountVar) {
238 		engine.setProperty(Properties.ROW_COUNT_VAR, rowCountVar);
239 	}
240 
241 	/**
242 	 * Sets a string value specifying the name of the variable receiving the number of rows.
243 	 * @param rowCountVar variable name
244 	 */
245 	/**
246 	 * Returns <code>true</code> if the attribute "rowCountVar" is set.
247 	 * @return <code>true</code> if the attribute is set.
248 	 */
249 	public boolean isRowCountVarSetted() {
250 		return engine.isPropertySetted(Properties.ROW_COUNT_VAR);
251 	}
252 
253 	/**
254 	 * Returns a string value specifying the name of the variable receiving the index of the current row.
255 	 * @return variable name
256 	 */
257 	public String getRowIndexVar() {
258 		return getRowIndexVar(null);
259 	}
260 
261 	/**
262 	 * Returns a string value specifying the name of the variable receiving the index of the current row.
263 	 * @return variable name
264 	 */
265 	public String getRowIndexVar(javax.faces.context.FacesContext facesContext) {
266 		return engine.getStringProperty(Properties.ROW_INDEX_VAR, facesContext);
267 	}
268 
269 	/**
270 	 * Sets a string value specifying the name of the variable receiving the index of the current row.
271 	 * @param rowIndexVar variable name
272 	 */
273 	public void setRowIndexVar(String rowIndexVar) {
274 		engine.setProperty(Properties.ROW_INDEX_VAR, rowIndexVar);
275 	}
276 
277 	/**
278 	 * Sets a string value specifying the name of the variable receiving the index of the current row.
279 	 * @param rowIndexVar variable name
280 	 */
281 	/**
282 	 * Returns <code>true</code> if the attribute "rowIndexVar" is set.
283 	 * @return <code>true</code> if the attribute is set.
284 	 */
285 	public boolean isRowIndexVarSetted() {
286 		return engine.isPropertySetted(Properties.ROW_INDEX_VAR);
287 	}
288 
289 	/**
290 	 * Returns an int value holding the width of the component in characters : x characters translates into y pixels width.
291 	 * @return width in characters
292 	 */
293 	public int getColumnNumber() {
294 		return getColumnNumber(null);
295 	}
296 
297 	/**
298 	 * Returns an int value holding the width of the component in characters : x characters translates into y pixels width.
299 	 * @return width in characters
300 	 */
301 	public int getColumnNumber(javax.faces.context.FacesContext facesContext) {
302 		return engine.getIntProperty(Properties.COLUMN_NUMBER, 0, facesContext);
303 	}
304 
305 	/**
306 	 * Sets an int value holding the width of the component in characters : x characters translates into y pixels width.
307 	 * @param columnNumber width in characters
308 	 */
309 	public void setColumnNumber(int columnNumber) {
310 		engine.setProperty(Properties.COLUMN_NUMBER, columnNumber);
311 	}
312 
313 	/**
314 	 * Sets an int value holding the width of the component in characters : x characters translates into y pixels width.
315 	 * @param columnNumber width in characters
316 	 */
317 	/**
318 	 * Returns <code>true</code> if the attribute "columnNumber" is set.
319 	 * @return <code>true</code> if the attribute is set.
320 	 */
321 	public boolean isColumnNumberSetted() {
322 		return engine.isPropertySetted(Properties.COLUMN_NUMBER);
323 	}
324 
325 	/**
326 	 * Returns a space-separated list of CSS style class(es) to be applied when the row is rendered. This value will be passed through as the "class" attribute on generated markup.
327 	 * @return list of CSS style classes
328 	 */
329 	public String getRowStyleClass() {
330 		return getRowStyleClass(null);
331 	}
332 
333 	/**
334 	 * Returns a space-separated list of CSS style class(es) to be applied when the row is rendered. This value will be passed through as the "class" attribute on generated markup.
335 	 * @return list of CSS style classes
336 	 */
337 	public String getRowStyleClass(javax.faces.context.FacesContext facesContext) {
338 		return engine.getStringProperty(Properties.ROW_STYLE_CLASS, facesContext);
339 	}
340 
341 	/**
342 	 * Sets a space-separated list of CSS style class(es) to be applied when the row is rendered. This value will be passed through as the "class" attribute on generated markup.
343 	 * @param rowStyleClass list of CSS style classes
344 	 */
345 	public void setRowStyleClass(String rowStyleClass) {
346 		engine.setProperty(Properties.ROW_STYLE_CLASS, rowStyleClass);
347 	}
348 
349 	/**
350 	 * Sets a space-separated list of CSS style class(es) to be applied when the row is rendered. This value will be passed through as the "class" attribute on generated markup.
351 	 * @param rowStyleClass list of CSS style classes
352 	 */
353 	/**
354 	 * Returns <code>true</code> if the attribute "rowStyleClass" is set.
355 	 * @return <code>true</code> if the attribute is set.
356 	 */
357 	public boolean isRowStyleClassSetted() {
358 		return engine.isPropertySetted(Properties.ROW_STYLE_CLASS);
359 	}
360 
361 	/**
362 	 * Returns a space-separated list of CSS style class(es) to be applied when this column is rendered. This value will be passed through as the "class" attribute on generated markup.
363 	 * @return list of CSS style classes
364 	 */
365 	public String getColumnStyleClass() {
366 		return getColumnStyleClass(null);
367 	}
368 
369 	/**
370 	 * Returns a space-separated list of CSS style class(es) to be applied when this column is rendered. This value will be passed through as the "class" attribute on generated markup.
371 	 * @return list of CSS style classes
372 	 */
373 	public String getColumnStyleClass(javax.faces.context.FacesContext facesContext) {
374 		return engine.getStringProperty(Properties.COLUMN_STYLE_CLASS, facesContext);
375 	}
376 
377 	/**
378 	 * Sets a space-separated list of CSS style class(es) to be applied when this column is rendered. This value will be passed through as the "class" attribute on generated markup.
379 	 * @param columnStyleClass list of CSS style classes
380 	 */
381 	public void setColumnStyleClass(String columnStyleClass) {
382 		engine.setProperty(Properties.COLUMN_STYLE_CLASS, columnStyleClass);
383 	}
384 
385 	/**
386 	 * Sets a space-separated list of CSS style class(es) to be applied when this column is rendered. This value will be passed through as the "class" attribute on generated markup.
387 	 * @param columnStyleClass list of CSS style classes
388 	 */
389 	/**
390 	 * Returns <code>true</code> if the attribute "columnStyleClass" is set.
391 	 * @return <code>true</code> if the attribute is set.
392 	 */
393 	public boolean isColumnStyleClassSetted() {
394 		return engine.isPropertySetted(Properties.COLUMN_STYLE_CLASS);
395 	}
396 
397 	protected Set getCameliaFields() {
398 		return CAMELIA_ATTRIBUTES;
399 	}
400 }