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 import org.rcfaces.core.internal.capability.IVariableScopeCapability;
12
13 public class ScopeComponent extends CameliaBaseComponent implements
14 IVariableScopeCapability {
15
16 private static final Log LOG = LogFactory.getLog(ScopeComponent.class);
17
18 public static final String COMPONENT_TYPE="org.rcfaces.core.scope";
19
20 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaBaseComponent.CAMELIA_ATTRIBUTES);
21 static {
22 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"scopeSaveValue","scopeVar","scopeValue"}));
23 }
24
25 public ScopeComponent() {
26 setRendererType(COMPONENT_TYPE);
27 }
28
29 public ScopeComponent(String componentId) {
30 this();
31 setId(componentId);
32 }
33
34 public boolean isScopeSaveValue() {
35 return isScopeSaveValue(null);
36 }
37
38
39
40
41 public boolean isScopeSaveValue(javax.faces.context.FacesContext facesContext) {
42 return engine.getBoolProperty(Properties.SCOPE_SAVE_VALUE, false, facesContext);
43 }
44
45
46
47
48
49 public final boolean isScopeSaveValueSetted() {
50 return engine.isPropertySetted(Properties.SCOPE_SAVE_VALUE);
51 }
52
53 public void setScopeSaveValue(boolean scopeSaveValue) {
54 engine.setProperty(Properties.SCOPE_SAVE_VALUE, scopeSaveValue);
55 }
56
57 public java.lang.Object getScopeValue() {
58 return getScopeValue(null);
59 }
60
61
62
63
64 public java.lang.Object getScopeValue(javax.faces.context.FacesContext facesContext) {
65 return engine.getProperty(Properties.SCOPE_VALUE, facesContext);
66 }
67
68
69
70
71
72 public final boolean isScopeValueSetted() {
73 return engine.isPropertySetted(Properties.SCOPE_VALUE);
74 }
75
76 public void setScopeValue(java.lang.Object scopeValue) {
77 engine.setProperty(Properties.SCOPE_VALUE, scopeValue);
78 }
79
80 public java.lang.String getScopeVar() {
81 return getScopeVar(null);
82 }
83
84
85
86
87 public java.lang.String getScopeVar(javax.faces.context.FacesContext facesContext) {
88 return engine.getStringProperty(Properties.SCOPE_VAR, facesContext);
89 }
90
91
92
93
94
95 public final boolean isScopeVarSetted() {
96 return engine.isPropertySetted(Properties.SCOPE_VAR);
97 }
98
99 public void setScopeVar(java.lang.String scopeVar) {
100 engine.setProperty(Properties.SCOPE_VAR, scopeVar);
101 }
102
103 protected Set getCameliaFields() {
104 return CAMELIA_ATTRIBUTES;
105 }
106 }