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.rcfaces.core.internal.component.CameliaBaseComponent;
6   import org.apache.commons.logging.Log;
7   import java.util.HashSet;
8   import org.apache.commons.logging.LogFactory;
9   import java.util.Arrays;
10  import java.util.Set;
11  
12  /**
13   * <p>The focusManager Component is a non-visual component.</p>
14   * <p>It allows to deal with the focus on the current page.</p>
15   * 
16   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/FocuManagerComponent.html">focuManager</a> renderer is link to the <a href="/jsdocs/index.html?f_focuManager.html" target="_blank">f_focuManager</a> javascript class. f_focuManager extends f_object, fa_serializable</p>
17   */
18  public class FocusManagerComponent extends CameliaBaseComponent {
19  
20  	private static final Log LOG = LogFactory.getLog(FocusManagerComponent.class);
21  
22  	public static final String COMPONENT_TYPE="org.rcfaces.core.focusManager";
23  
24  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaBaseComponent.CAMELIA_ATTRIBUTES);
25  	static {
26  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"focusId","setFocusIfMessage"}));
27  	}
28  
29  	public FocusManagerComponent() {
30  		setRendererType(COMPONENT_TYPE);
31  	}
32  
33  	public FocusManagerComponent(String componentId) {
34  		this();
35  		setId(componentId);
36  	}
37  
38  	/**
39  	 * Returns a component's id. This component will get the focus.
40  	 * @return id
41  	 */
42  	public String getFocusId() {
43  		return getFocusId(null);
44  	}
45  
46  	/**
47  	 * Returns a component's id. This component will get the focus.
48  	 * @return id
49  	 */
50  	public String getFocusId(javax.faces.context.FacesContext facesContext) {
51  		return engine.getStringProperty(Properties.FOCUS_ID, facesContext);
52  	}
53  
54  	/**
55  	 * Sets a component's id. This component will get the focus.
56  	 * @param focusId id
57  	 */
58  	public void setFocusId(String focusId) {
59  		engine.setProperty(Properties.FOCUS_ID, focusId);
60  	}
61  
62  	/**
63  	 * Sets a component's id. This component will get the focus.
64  	 * @param focusId id
65  	 */
66  	/**
67  	 * Returns <code>true</code> if the attribute "focusId" is set.
68  	 * @return <code>true</code> if the attribute is set.
69  	 */
70  	public boolean isFocusIdSetted() {
71  		return engine.isPropertySetted(Properties.FOCUS_ID);
72  	}
73  
74  	public boolean isSetFocusIfMessage() {
75  		return isSetFocusIfMessage(null);
76  	}
77  
78  	public boolean isSetFocusIfMessage(javax.faces.context.FacesContext facesContext) {
79  		return engine.getBoolProperty(Properties.SET_FOCUS_IF_MESSAGE, true, facesContext);
80  	}
81  
82  	public void setSetFocusIfMessage(boolean setFocusIfMessage) {
83  		engine.setProperty(Properties.SET_FOCUS_IF_MESSAGE, setFocusIfMessage);
84  	}
85  
86  	/**
87  	 * Returns <code>true</code> if the attribute "setFocusIfMessage" is set.
88  	 * @return <code>true</code> if the attribute is set.
89  	 */
90  	public boolean isSetFocusIfMessageSetted() {
91  		return engine.isPropertySetted(Properties.SET_FOCUS_IF_MESSAGE);
92  	}
93  
94  	protected Set getCameliaFields() {
95  		return CAMELIA_ATTRIBUTES;
96  	}
97  }