View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.internal.component.Properties;
4   import org.rcfaces.core.component.capability.IUserEventCapability;
5   import org.apache.commons.logging.LogFactory;
6   import org.rcfaces.core.component.capability.IWidthCapability;
7   import javax.faces.context.FacesContext;
8   import org.rcfaces.core.component.capability.IToolTipCapability;
9   import org.apache.commons.logging.Log;
10  import java.util.Set;
11  import org.rcfaces.core.internal.component.CameliaValueColumnComponent;
12  import org.rcfaces.core.component.capability.IInitEventCapability;
13  import org.rcfaces.core.component.capability.IDoubleClickEventCapability;
14  import org.rcfaces.core.component.capability.ISelectionEventCapability;
15  import java.lang.String;
16  import org.rcfaces.core.component.capability.IForegroundBackgroundColorCapability;
17  import org.rcfaces.core.component.capability.IHeightCapability;
18  import org.rcfaces.core.internal.converter.AlignmentNormalizer;
19  import javax.faces.convert.Converter;
20  import org.rcfaces.core.component.capability.IAlignmentCapability;
21  import org.rcfaces.core.component.capability.ITextDirectionCapability;
22  import javax.el.ValueExpression;
23  import java.util.HashSet;
24  import org.rcfaces.core.component.capability.IStyleClassCapability;
25  import java.util.Arrays;
26  import org.rcfaces.core.component.capability.ITextCapability;
27  import org.rcfaces.core.component.capability.IVerticalAlignmentCapability;
28  
29  public class SchedulerColumnComponent extends CameliaValueColumnComponent implements 
30  	ITextCapability,
31  	ITextDirectionCapability,
32  	IToolTipCapability,
33  	IAlignmentCapability,
34  	IForegroundBackgroundColorCapability,
35  	IStyleClassCapability,
36  	IWidthCapability,
37  	IHeightCapability,
38  	IVerticalAlignmentCapability,
39  	ISelectionEventCapability,
40  	IDoubleClickEventCapability,
41  	IUserEventCapability,
42  	IInitEventCapability {
43  
44  	private static final Log LOG = LogFactory.getLog(SchedulerColumnComponent.class);
45  
46  	public static final String COMPONENT_TYPE="org.rcfaces.core.schedulerColumn";
47  
48  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaValueColumnComponent.CAMELIA_ATTRIBUTES);
49  	static {
50  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"alignment","text","userEventListener","backgroundColor","styleClass","width","doubleClickListener","initListener","textDirection","selectionListener","verticalAlignment","height","value","toolTipText","foregroundColor"}));
51  	}
52  
53  	public SchedulerColumnComponent() {
54  		setRendererType(null);
55  	}
56  
57  	public SchedulerColumnComponent(String componentId) {
58  		this();
59  		setId(componentId);
60  	}
61  
62  	public void setConverter(String converterId) {
63  
64  
65  			 setConverter(null, converterId);
66  		
67  	}
68  
69  	public void setConverter(FacesContext facesContext, String converterId) {
70  
71  
72  			if (facesContext==null) {
73  				facesContext=FacesContext.getCurrentInstance();
74  			}
75  			Converter converter = facesContext.getApplication().createConverter(converterId);
76              this.setConverter(converter);
77  		
78  	}
79  
80  	public void setConverter(Converter converter) {
81  
82  
83          	engine.setProperty("converter", converter);
84  		
85  	}
86  
87  	public Converter getConverter() {
88  
89  
90          	return (Converter)engine.getProperty("converter", null);
91  		
92  	}
93  
94  	public Object getLocalValue() {
95  
96  
97  				return engine.getLocalValue(Properties.VALUE);
98  			
99  	}
100 
101 	public Object getValue() {
102 
103 
104 				return getValue(null);
105 			
106 	}
107 
108 	public Object getValue(FacesContext context) {
109 
110 
111 				return engine.getValue(Properties.VALUE, context);
112 			
113 	}
114 
115 	public void setValue(Object value) {
116 
117 
118 				engine.setValue(Properties.VALUE, value);
119 			
120 	}
121 
122 	public java.lang.String getText() {
123 		return getText(null);
124 	}
125 
126 	/**
127 	 * See {@link #getText() getText()} for more details
128 	 */
129 	public java.lang.String getText(javax.faces.context.FacesContext facesContext) {
130 		return engine.getStringProperty(Properties.TEXT, facesContext);
131 	}
132 
133 	/**
134 	 * Returns <code>true</code> if the attribute "text" is set.
135 	 * @return <code>true</code> if the attribute is set.
136 	 */
137 	public final boolean isTextSetted() {
138 		return engine.isPropertySetted(Properties.TEXT);
139 	}
140 
141 	public void setText(java.lang.String text) {
142 		engine.setProperty(Properties.TEXT, text);
143 	}
144 
145 	public int getTextDirection() {
146 		return getTextDirection(null);
147 	}
148 
149 	/**
150 	 * See {@link #getTextDirection() getTextDirection()} for more details
151 	 */
152 	public int getTextDirection(javax.faces.context.FacesContext facesContext) {
153 		return engine.getIntProperty(Properties.TEXT_DIRECTION,0, facesContext);
154 	}
155 
156 	/**
157 	 * Returns <code>true</code> if the attribute "textDirection" is set.
158 	 * @return <code>true</code> if the attribute is set.
159 	 */
160 	public final boolean isTextDirectionSetted() {
161 		return engine.isPropertySetted(Properties.TEXT_DIRECTION);
162 	}
163 
164 	public void setTextDirection(int textDirection) {
165 		engine.setProperty(Properties.TEXT_DIRECTION, textDirection);
166 	}
167 
168 	public java.lang.String getToolTipText() {
169 		return getToolTipText(null);
170 	}
171 
172 	/**
173 	 * See {@link #getToolTipText() getToolTipText()} for more details
174 	 */
175 	public java.lang.String getToolTipText(javax.faces.context.FacesContext facesContext) {
176 		return engine.getStringProperty(Properties.TOOL_TIP_TEXT, facesContext);
177 	}
178 
179 	/**
180 	 * Returns <code>true</code> if the attribute "toolTipText" is set.
181 	 * @return <code>true</code> if the attribute is set.
182 	 */
183 	public final boolean isToolTipTextSetted() {
184 		return engine.isPropertySetted(Properties.TOOL_TIP_TEXT);
185 	}
186 
187 	public void setToolTipText(java.lang.String toolTipText) {
188 		engine.setProperty(Properties.TOOL_TIP_TEXT, toolTipText);
189 	}
190 
191 	public java.lang.String getAlignment() {
192 		return getAlignment(null);
193 	}
194 
195 	/**
196 	 * See {@link #getAlignment() getAlignment()} for more details
197 	 */
198 	public java.lang.String getAlignment(javax.faces.context.FacesContext facesContext) {
199 		return engine.getStringProperty(Properties.ALIGNMENT, facesContext);
200 	}
201 
202 	/**
203 	 * Returns <code>true</code> if the attribute "alignment" is set.
204 	 * @return <code>true</code> if the attribute is set.
205 	 */
206 	public final boolean isAlignmentSetted() {
207 		return engine.isPropertySetted(Properties.ALIGNMENT);
208 	}
209 
210 	public void setAlignment(String alignment) {
211 
212 
213 			engine.setProperty(Properties.ALIGNMENT, AlignmentNormalizer.normalize(alignment));
214     	
215 	}
216 
217 	public java.lang.String getBackgroundColor() {
218 		return getBackgroundColor(null);
219 	}
220 
221 	/**
222 	 * See {@link #getBackgroundColor() getBackgroundColor()} for more details
223 	 */
224 	public java.lang.String getBackgroundColor(javax.faces.context.FacesContext facesContext) {
225 		return engine.getStringProperty(Properties.BACKGROUND_COLOR, facesContext);
226 	}
227 
228 	/**
229 	 * Returns <code>true</code> if the attribute "backgroundColor" is set.
230 	 * @return <code>true</code> if the attribute is set.
231 	 */
232 	public final boolean isBackgroundColorSetted() {
233 		return engine.isPropertySetted(Properties.BACKGROUND_COLOR);
234 	}
235 
236 	public void setBackgroundColor(java.lang.String backgroundColor) {
237 		engine.setProperty(Properties.BACKGROUND_COLOR, backgroundColor);
238 	}
239 
240 	public java.lang.String getForegroundColor() {
241 		return getForegroundColor(null);
242 	}
243 
244 	/**
245 	 * See {@link #getForegroundColor() getForegroundColor()} for more details
246 	 */
247 	public java.lang.String getForegroundColor(javax.faces.context.FacesContext facesContext) {
248 		return engine.getStringProperty(Properties.FOREGROUND_COLOR, facesContext);
249 	}
250 
251 	/**
252 	 * Returns <code>true</code> if the attribute "foregroundColor" is set.
253 	 * @return <code>true</code> if the attribute is set.
254 	 */
255 	public final boolean isForegroundColorSetted() {
256 		return engine.isPropertySetted(Properties.FOREGROUND_COLOR);
257 	}
258 
259 	public void setForegroundColor(java.lang.String foregroundColor) {
260 		engine.setProperty(Properties.FOREGROUND_COLOR, foregroundColor);
261 	}
262 
263 	public java.lang.String getStyleClass() {
264 		return getStyleClass(null);
265 	}
266 
267 	/**
268 	 * See {@link #getStyleClass() getStyleClass()} for more details
269 	 */
270 	public java.lang.String getStyleClass(javax.faces.context.FacesContext facesContext) {
271 		return engine.getStringProperty(Properties.STYLE_CLASS, facesContext);
272 	}
273 
274 	/**
275 	 * Returns <code>true</code> if the attribute "styleClass" is set.
276 	 * @return <code>true</code> if the attribute is set.
277 	 */
278 	public final boolean isStyleClassSetted() {
279 		return engine.isPropertySetted(Properties.STYLE_CLASS);
280 	}
281 
282 	public void setStyleClass(java.lang.String styleClass) {
283 		engine.setProperty(Properties.STYLE_CLASS, styleClass);
284 	}
285 
286 	public java.lang.String getWidth() {
287 		return getWidth(null);
288 	}
289 
290 	/**
291 	 * See {@link #getWidth() getWidth()} for more details
292 	 */
293 	public java.lang.String getWidth(javax.faces.context.FacesContext facesContext) {
294 		return engine.getStringProperty(Properties.WIDTH, facesContext);
295 	}
296 
297 	/**
298 	 * Returns <code>true</code> if the attribute "width" is set.
299 	 * @return <code>true</code> if the attribute is set.
300 	 */
301 	public final boolean isWidthSetted() {
302 		return engine.isPropertySetted(Properties.WIDTH);
303 	}
304 
305 	public void setWidth(java.lang.String width) {
306 		engine.setProperty(Properties.WIDTH, width);
307 	}
308 
309 	public java.lang.String getHeight() {
310 		return getHeight(null);
311 	}
312 
313 	/**
314 	 * See {@link #getHeight() getHeight()} for more details
315 	 */
316 	public java.lang.String getHeight(javax.faces.context.FacesContext facesContext) {
317 		return engine.getStringProperty(Properties.HEIGHT, facesContext);
318 	}
319 
320 	/**
321 	 * Returns <code>true</code> if the attribute "height" is set.
322 	 * @return <code>true</code> if the attribute is set.
323 	 */
324 	public final boolean isHeightSetted() {
325 		return engine.isPropertySetted(Properties.HEIGHT);
326 	}
327 
328 	public void setHeight(java.lang.String height) {
329 		engine.setProperty(Properties.HEIGHT, height);
330 	}
331 
332 	public java.lang.String getVerticalAlignment() {
333 		return getVerticalAlignment(null);
334 	}
335 
336 	/**
337 	 * See {@link #getVerticalAlignment() getVerticalAlignment()} for more details
338 	 */
339 	public java.lang.String getVerticalAlignment(javax.faces.context.FacesContext facesContext) {
340 		return engine.getStringProperty(Properties.VERTICAL_ALIGNMENT, facesContext);
341 	}
342 
343 	/**
344 	 * Returns <code>true</code> if the attribute "verticalAlignment" is set.
345 	 * @return <code>true</code> if the attribute is set.
346 	 */
347 	public final boolean isVerticalAlignmentSetted() {
348 		return engine.isPropertySetted(Properties.VERTICAL_ALIGNMENT);
349 	}
350 
351 	public void setVerticalAlignment(java.lang.String verticalAlignment) {
352 		engine.setProperty(Properties.VERTICAL_ALIGNMENT, verticalAlignment);
353 	}
354 
355 	public final void addSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
356 		addFacesListener(listener);
357 	}
358 
359 	public final void removeSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
360 		removeFacesListener(listener);
361 	}
362 
363 	public final javax.faces.event.FacesListener [] listSelectionListeners() {
364 		return getFacesListeners(org.rcfaces.core.event.ISelectionListener.class);
365 	}
366 
367 	public final void addDoubleClickListener(org.rcfaces.core.event.IDoubleClickListener listener) {
368 		addFacesListener(listener);
369 	}
370 
371 	public final void removeDoubleClickListener(org.rcfaces.core.event.IDoubleClickListener listener) {
372 		removeFacesListener(listener);
373 	}
374 
375 	public final javax.faces.event.FacesListener [] listDoubleClickListeners() {
376 		return getFacesListeners(org.rcfaces.core.event.IDoubleClickListener.class);
377 	}
378 
379 	public final void addUserEventListener(org.rcfaces.core.event.IUserEventListener listener) {
380 		addFacesListener(listener);
381 	}
382 
383 	public final void removeUserEventListener(org.rcfaces.core.event.IUserEventListener listener) {
384 		removeFacesListener(listener);
385 	}
386 
387 	public final javax.faces.event.FacesListener [] listUserEventListeners() {
388 		return getFacesListeners(org.rcfaces.core.event.IUserEventListener.class);
389 	}
390 
391 	public final void addInitListener(org.rcfaces.core.event.IInitListener listener) {
392 		addFacesListener(listener);
393 	}
394 
395 	public final void removeInitListener(org.rcfaces.core.event.IInitListener listener) {
396 		removeFacesListener(listener);
397 	}
398 
399 	public final javax.faces.event.FacesListener [] listInitListeners() {
400 		return getFacesListeners(org.rcfaces.core.event.IInitListener.class);
401 	}
402 
403 	protected Set getCameliaFields() {
404 		return CAMELIA_ATTRIBUTES;
405 	}
406 }