1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.internal.component.Properties;
4 import javax.el.ValueExpression;
5 import org.apache.commons.logging.Log;
6 import java.util.HashSet;
7 import org.rcfaces.core.component.AbstractMessagesComponent;
8 import org.apache.commons.logging.LogFactory;
9 import java.util.Arrays;
10 import java.util.Set;
11 import org.rcfaces.core.component.capability.ISeverityStyleClassCapability;
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 public class MessagesComponent extends AbstractMessagesComponent implements
40 ISeverityStyleClassCapability {
41
42 private static final Log LOG = LogFactory.getLog(MessagesComponent.class);
43
44 public static final String COMPONENT_TYPE="org.rcfaces.core.messages";
45
46 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractMessagesComponent.CAMELIA_ATTRIBUTES);
47 static {
48 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"fatalStyleClass","showIfMessage","warnStyleClass","errorStyleClass","infoStyleClass","styleClass","maxCount","showActiveComponentMessage"}));
49 }
50
51 public MessagesComponent() {
52 setRendererType(COMPONENT_TYPE);
53 }
54
55 public MessagesComponent(String componentId) {
56 this();
57 setId(componentId);
58 }
59
60 public java.lang.String getErrorStyleClass() {
61 return getErrorStyleClass(null);
62 }
63
64
65
66
67 public java.lang.String getErrorStyleClass(javax.faces.context.FacesContext facesContext) {
68 return engine.getStringProperty(Properties.ERROR_STYLE_CLASS, facesContext);
69 }
70
71
72
73
74
75 public final boolean isErrorStyleClassSetted() {
76 return engine.isPropertySetted(Properties.ERROR_STYLE_CLASS);
77 }
78
79 public void setErrorStyleClass(java.lang.String errorStyleClass) {
80 engine.setProperty(Properties.ERROR_STYLE_CLASS, errorStyleClass);
81 }
82
83 public java.lang.String getFatalStyleClass() {
84 return getFatalStyleClass(null);
85 }
86
87
88
89
90 public java.lang.String getFatalStyleClass(javax.faces.context.FacesContext facesContext) {
91 return engine.getStringProperty(Properties.FATAL_STYLE_CLASS, facesContext);
92 }
93
94
95
96
97
98 public final boolean isFatalStyleClassSetted() {
99 return engine.isPropertySetted(Properties.FATAL_STYLE_CLASS);
100 }
101
102 public void setFatalStyleClass(java.lang.String fatalStyleClass) {
103 engine.setProperty(Properties.FATAL_STYLE_CLASS, fatalStyleClass);
104 }
105
106 public java.lang.String getInfoStyleClass() {
107 return getInfoStyleClass(null);
108 }
109
110
111
112
113 public java.lang.String getInfoStyleClass(javax.faces.context.FacesContext facesContext) {
114 return engine.getStringProperty(Properties.INFO_STYLE_CLASS, facesContext);
115 }
116
117
118
119
120
121 public final boolean isInfoStyleClassSetted() {
122 return engine.isPropertySetted(Properties.INFO_STYLE_CLASS);
123 }
124
125 public void setInfoStyleClass(java.lang.String infoStyleClass) {
126 engine.setProperty(Properties.INFO_STYLE_CLASS, infoStyleClass);
127 }
128
129 public java.lang.String getWarnStyleClass() {
130 return getWarnStyleClass(null);
131 }
132
133
134
135
136 public java.lang.String getWarnStyleClass(javax.faces.context.FacesContext facesContext) {
137 return engine.getStringProperty(Properties.WARN_STYLE_CLASS, facesContext);
138 }
139
140
141
142
143
144 public final boolean isWarnStyleClassSetted() {
145 return engine.isPropertySetted(Properties.WARN_STYLE_CLASS);
146 }
147
148 public void setWarnStyleClass(java.lang.String warnStyleClass) {
149 engine.setProperty(Properties.WARN_STYLE_CLASS, warnStyleClass);
150 }
151
152 public boolean isShowIfMessage() {
153 return isShowIfMessage(null);
154 }
155
156 public boolean isShowIfMessage(javax.faces.context.FacesContext facesContext) {
157 return engine.getBoolProperty(Properties.SHOW_IF_MESSAGE, false, facesContext);
158 }
159
160 public void setShowIfMessage(boolean showIfMessage) {
161 engine.setProperty(Properties.SHOW_IF_MESSAGE, showIfMessage);
162 }
163
164
165
166
167
168 public boolean isShowIfMessageSetted() {
169 return engine.isPropertySetted(Properties.SHOW_IF_MESSAGE);
170 }
171
172 public boolean isShowActiveComponentMessage() {
173 return isShowActiveComponentMessage(null);
174 }
175
176 public boolean isShowActiveComponentMessage(javax.faces.context.FacesContext facesContext) {
177 return engine.getBoolProperty(Properties.SHOW_ACTIVE_COMPONENT_MESSAGE, false, facesContext);
178 }
179
180 public void setShowActiveComponentMessage(boolean showActiveComponentMessage) {
181 engine.setProperty(Properties.SHOW_ACTIVE_COMPONENT_MESSAGE, showActiveComponentMessage);
182 }
183
184
185
186
187
188 public boolean isShowActiveComponentMessageSetted() {
189 return engine.isPropertySetted(Properties.SHOW_ACTIVE_COMPONENT_MESSAGE);
190 }
191
192 public int getMaxCount() {
193 return getMaxCount(null);
194 }
195
196 public int getMaxCount(javax.faces.context.FacesContext facesContext) {
197 return engine.getIntProperty(Properties.MAX_COUNT, 0, facesContext);
198 }
199
200 public void setMaxCount(int maxCount) {
201 engine.setProperty(Properties.MAX_COUNT, maxCount);
202 }
203
204
205
206
207
208 public boolean isMaxCountSetted() {
209 return engine.isPropertySetted(Properties.MAX_COUNT);
210 }
211
212 protected Set getCameliaFields() {
213 return CAMELIA_ATTRIBUTES;
214 }
215 }