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
14
15
16
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
40
41
42 public String getFocusId() {
43 return getFocusId(null);
44 }
45
46
47
48
49
50 public String getFocusId(javax.faces.context.FacesContext facesContext) {
51 return engine.getStringProperty(Properties.FOCUS_ID, facesContext);
52 }
53
54
55
56
57
58 public void setFocusId(String focusId) {
59 engine.setProperty(Properties.FOCUS_ID, focusId);
60 }
61
62
63
64
65
66
67
68
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
88
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 }