View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.component.capability.ISelectionEventCapability;
4   import org.rcfaces.core.internal.component.Properties;
5   import java.lang.String;
6   import org.apache.commons.logging.LogFactory;
7   import org.rcfaces.core.component.capability.IRequiredCapability;
8   import org.rcfaces.core.component.capability.IFocusStyleClassCapability;
9   import org.rcfaces.core.internal.converter.FilterPropertiesConverter;
10  import javax.el.ValueExpression;
11  import java.util.HashSet;
12  import org.apache.commons.logging.Log;
13  import org.rcfaces.core.component.capability.IFilterCapability;
14  import org.rcfaces.core.model.IFilterProperties;
15  import java.util.Set;
16  import java.util.Arrays;
17  import org.rcfaces.core.component.AbstractInputComponent;
18  import org.rcfaces.core.component.capability.ISeverityStyleClassCapability;
19  
20  /**
21   * <p>The combo Component is equivalent to the standard HTML tag &lt;SELECT SIZE=1&gt;.</p>
22   * <p>The combo Component has the following capabilities :
23   * <ul>
24   * <li>ISelectionEventCapability</li>
25   * <li>IRequiredCapability</li>
26   * <li>IFocusStyleClassCapability</li>
27   * <li>ISeverityStyleClassCapability</li>
28   * <li>IFilterCapability </li>
29   * </ul>
30   * </p>
31   * 
32   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/ComboComponent.html">comboComponent</a> renderer is linked to the <a href="/jsdocs/index.html?f_combo.html" target="_blank">f_combo</a> javascript class. f_combo extends f_abstractList, fa_selectionProvider</p>
33   * 
34   * <p> Table of component style classes: </p>
35   * <table border="1" cellpadding="3" cellspacing="0" width="100%">
36   * <tbody>
37   * 
38   * <tr style="text-align:left">
39   * <th  width="33%">Style Name</th>
40   * <th width="50%">Description</th>
41   * </tr>
42   * 
43   * <tr  style="text-align:left">
44   * <td width="33%">f_combo</td>
45   * <td width="50%">Defines styles for the wrapper Select element</td>
46   * </tr>
47   * 
48   * </tbody>
49   * </table>
50   */
51  public class ComboComponent extends AbstractInputComponent implements 
52  	ISelectionEventCapability,
53  	IRequiredCapability,
54  	IFocusStyleClassCapability,
55  	ISeverityStyleClassCapability,
56  	IFilterCapability {
57  
58  	private static final Log LOG = LogFactory.getLog(ComboComponent.class);
59  
60  	public static final String COMPONENT_TYPE="org.rcfaces.core.combo";
61  
62  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractInputComponent.CAMELIA_ATTRIBUTES);
63  	static {
64  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"focusStyleClass","selectionListener","filterProperties","fatalStyleClass","warnStyleClass","errorStyleClass","infoStyleClass","styleClass","required"}));
65  	}
66  	protected static final String CAMELIA_VALUE_ALIAS="value";
67  
68  	public ComboComponent() {
69  		setRendererType(COMPONENT_TYPE);
70  	}
71  
72  	public ComboComponent(String componentId) {
73  		this();
74  		setId(componentId);
75  	}
76  
77  	public void setFilterProperties(String properties) {
78  
79  
80  			IFilterProperties filterProperties=(IFilterProperties)FilterPropertiesConverter.SINGLETON.getAsObject(null, this, properties);
81  			
82  			setFilterProperties(filterProperties);
83  		
84  	}
85  
86  	public final void addSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
87  		addFacesListener(listener);
88  	}
89  
90  	public final void removeSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
91  		removeFacesListener(listener);
92  	}
93  
94  	public final javax.faces.event.FacesListener [] listSelectionListeners() {
95  		return getFacesListeners(org.rcfaces.core.event.ISelectionListener.class);
96  	}
97  
98  	public java.lang.String getFocusStyleClass() {
99  		return getFocusStyleClass(null);
100 	}
101 
102 	/**
103 	 * See {@link #getFocusStyleClass() getFocusStyleClass()} for more details
104 	 */
105 	public java.lang.String getFocusStyleClass(javax.faces.context.FacesContext facesContext) {
106 		return engine.getStringProperty(Properties.FOCUS_STYLE_CLASS, facesContext);
107 	}
108 
109 	/**
110 	 * Returns <code>true</code> if the attribute "focusStyleClass" is set.
111 	 * @return <code>true</code> if the attribute is set.
112 	 */
113 	public final boolean isFocusStyleClassSetted() {
114 		return engine.isPropertySetted(Properties.FOCUS_STYLE_CLASS);
115 	}
116 
117 	public void setFocusStyleClass(java.lang.String focusStyleClass) {
118 		engine.setProperty(Properties.FOCUS_STYLE_CLASS, focusStyleClass);
119 	}
120 
121 	public java.lang.String getErrorStyleClass() {
122 		return getErrorStyleClass(null);
123 	}
124 
125 	/**
126 	 * See {@link #getErrorStyleClass() getErrorStyleClass()} for more details
127 	 */
128 	public java.lang.String getErrorStyleClass(javax.faces.context.FacesContext facesContext) {
129 		return engine.getStringProperty(Properties.ERROR_STYLE_CLASS, facesContext);
130 	}
131 
132 	/**
133 	 * Returns <code>true</code> if the attribute "errorStyleClass" is set.
134 	 * @return <code>true</code> if the attribute is set.
135 	 */
136 	public final boolean isErrorStyleClassSetted() {
137 		return engine.isPropertySetted(Properties.ERROR_STYLE_CLASS);
138 	}
139 
140 	public void setErrorStyleClass(java.lang.String errorStyleClass) {
141 		engine.setProperty(Properties.ERROR_STYLE_CLASS, errorStyleClass);
142 	}
143 
144 	public java.lang.String getFatalStyleClass() {
145 		return getFatalStyleClass(null);
146 	}
147 
148 	/**
149 	 * See {@link #getFatalStyleClass() getFatalStyleClass()} for more details
150 	 */
151 	public java.lang.String getFatalStyleClass(javax.faces.context.FacesContext facesContext) {
152 		return engine.getStringProperty(Properties.FATAL_STYLE_CLASS, facesContext);
153 	}
154 
155 	/**
156 	 * Returns <code>true</code> if the attribute "fatalStyleClass" is set.
157 	 * @return <code>true</code> if the attribute is set.
158 	 */
159 	public final boolean isFatalStyleClassSetted() {
160 		return engine.isPropertySetted(Properties.FATAL_STYLE_CLASS);
161 	}
162 
163 	public void setFatalStyleClass(java.lang.String fatalStyleClass) {
164 		engine.setProperty(Properties.FATAL_STYLE_CLASS, fatalStyleClass);
165 	}
166 
167 	public java.lang.String getInfoStyleClass() {
168 		return getInfoStyleClass(null);
169 	}
170 
171 	/**
172 	 * See {@link #getInfoStyleClass() getInfoStyleClass()} for more details
173 	 */
174 	public java.lang.String getInfoStyleClass(javax.faces.context.FacesContext facesContext) {
175 		return engine.getStringProperty(Properties.INFO_STYLE_CLASS, facesContext);
176 	}
177 
178 	/**
179 	 * Returns <code>true</code> if the attribute "infoStyleClass" is set.
180 	 * @return <code>true</code> if the attribute is set.
181 	 */
182 	public final boolean isInfoStyleClassSetted() {
183 		return engine.isPropertySetted(Properties.INFO_STYLE_CLASS);
184 	}
185 
186 	public void setInfoStyleClass(java.lang.String infoStyleClass) {
187 		engine.setProperty(Properties.INFO_STYLE_CLASS, infoStyleClass);
188 	}
189 
190 	public java.lang.String getWarnStyleClass() {
191 		return getWarnStyleClass(null);
192 	}
193 
194 	/**
195 	 * See {@link #getWarnStyleClass() getWarnStyleClass()} for more details
196 	 */
197 	public java.lang.String getWarnStyleClass(javax.faces.context.FacesContext facesContext) {
198 		return engine.getStringProperty(Properties.WARN_STYLE_CLASS, facesContext);
199 	}
200 
201 	/**
202 	 * Returns <code>true</code> if the attribute "warnStyleClass" is set.
203 	 * @return <code>true</code> if the attribute is set.
204 	 */
205 	public final boolean isWarnStyleClassSetted() {
206 		return engine.isPropertySetted(Properties.WARN_STYLE_CLASS);
207 	}
208 
209 	public void setWarnStyleClass(java.lang.String warnStyleClass) {
210 		engine.setProperty(Properties.WARN_STYLE_CLASS, warnStyleClass);
211 	}
212 
213 	public org.rcfaces.core.model.IFilterProperties getFilterProperties() {
214 		return getFilterProperties(null);
215 	}
216 
217 	/**
218 	 * See {@link #getFilterProperties() getFilterProperties()} for more details
219 	 */
220 	public org.rcfaces.core.model.IFilterProperties getFilterProperties(javax.faces.context.FacesContext facesContext) {
221 		return (org.rcfaces.core.model.IFilterProperties)engine.getProperty(Properties.FILTER_PROPERTIES, facesContext);
222 	}
223 
224 	/**
225 	 * Returns <code>true</code> if the attribute "filterProperties" is set.
226 	 * @return <code>true</code> if the attribute is set.
227 	 */
228 	public final boolean isFilterPropertiesSetted() {
229 		return engine.isPropertySetted(Properties.FILTER_PROPERTIES);
230 	}
231 
232 	public void setFilterProperties(org.rcfaces.core.model.IFilterProperties filterProperties) {
233 		engine.setProperty(Properties.FILTER_PROPERTIES, filterProperties);
234 	}
235 
236 	protected Set getCameliaFields() {
237 		return CAMELIA_ATTRIBUTES;
238 	}
239 
240 	protected String getCameliaValueAlias() {
241 		return CAMELIA_VALUE_ALIAS;
242 	}
243 }