1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.internal.taglib;
21
22 import javax.faces.application.Application;
23 import javax.faces.component.UIComponent;
24 import javax.faces.context.FacesContext;
25 import org.apache.commons.lang.StringUtils;
26 import org.apache.myfaces.tobago.component.UIMessages;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30
31
32
33
34 public final class MessagesTag extends TobagoELTag {
35 private static final Logger LOG = LoggerFactory.getLogger(MessagesTag.class);
36 private javax.el.ValueExpression markup;
37 private javax.el.ValueExpression orderBy;
38 private javax.el.ValueExpression showSummary;
39 private javax.el.ValueExpression globalOnly;
40 private String forComponent;
41 private javax.el.ValueExpression maxSeverity;
42 private javax.el.ValueExpression minSeverity;
43 private javax.el.ValueExpression confirmation;
44 private javax.el.ValueExpression showDetail;
45 private javax.el.ValueExpression maxNumber;
46
47 @Override
48 public String getComponentType() {
49 return UIMessages.COMPONENT_TYPE;
50 }
51 @Override
52 public String getRendererType() {
53 return "Messages";
54 }
55
56 @Override
57 protected void setProperties(final UIComponent uiComponent) {
58 super.setProperties(uiComponent);
59 final UIMessages component = (UIMessages) uiComponent;
60 final FacesContext context = FacesContext.getCurrentInstance();
61 final Application application = context.getApplication();
62 if (markup != null) {
63 if (!markup.isLiteralText()) {
64 component.setValueExpression("markup", markup);
65 } else {
66 component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
67 }
68 }
69 if (orderBy != null) {
70 if (!orderBy.isLiteralText()) {
71 component.setValueExpression("orderBy", orderBy);
72 } else {
73 component.setOrderBy(org.apache.myfaces.tobago.internal.component.AbstractUIMessages.OrderBy.parse(orderBy.getExpressionString()));
74 }
75 }
76 if (showSummary != null) {
77 if (!showSummary.isLiteralText()) {
78 component.setValueExpression("showSummary", showSummary);
79 } else {
80 component.setShowSummary(Boolean.parseBoolean(showSummary.getExpressionString()));
81 }
82 }
83 if (globalOnly != null) {
84 component.setValueExpression("globalOnly", globalOnly);
85 }
86
87 if (forComponent != null) {
88 component.setFor(forComponent);
89 }
90
91 if (maxSeverity != null) {
92 if (!maxSeverity.isLiteralText()) {
93 component.setValueExpression("maxSeverity", maxSeverity);
94 } else {
95 component.getAttributes().put("maxSeverity", maxSeverity.getExpressionString());
96 }
97 }
98 if (minSeverity != null) {
99 if (!minSeverity.isLiteralText()) {
100 component.setValueExpression("minSeverity", minSeverity);
101 } else {
102 component.getAttributes().put("minSeverity", minSeverity.getExpressionString());
103 }
104 }
105 if (confirmation != null) {
106 if (!confirmation.isLiteralText()) {
107 component.setValueExpression("confirmation", confirmation);
108 } else {
109 component.setConfirmation(Boolean.parseBoolean(confirmation.getExpressionString()));
110 }
111 }
112 if (showDetail != null) {
113 if (!showDetail.isLiteralText()) {
114 component.setValueExpression("showDetail", showDetail);
115 } else {
116 component.setShowDetail(Boolean.parseBoolean(showDetail.getExpressionString()));
117 }
118 }
119 if (maxNumber != null) {
120 if (!maxNumber.isLiteralText()) {
121 component.setValueExpression("maxNumber", maxNumber);
122 } else {
123 component.setMaxNumber(Integer.parseInt(maxNumber.getExpressionString()));
124 }
125 }
126 }
127
128 public javax.el.ValueExpression getMarkup() {
129 return markup;
130 }
131
132 public void setMarkup(final javax.el.ValueExpression markup) {
133 this.markup = markup;
134 }
135
136 public javax.el.ValueExpression getOrderBy() {
137 return orderBy;
138 }
139
140 public void setOrderBy(final javax.el.ValueExpression orderBy) {
141 this.orderBy = orderBy;
142 }
143
144 public javax.el.ValueExpression getShowSummary() {
145 return showSummary;
146 }
147
148 public void setShowSummary(final javax.el.ValueExpression showSummary) {
149 this.showSummary = showSummary;
150 }
151
152 public javax.el.ValueExpression getGlobalOnly() {
153 return globalOnly;
154 }
155
156 public void setGlobalOnly(final javax.el.ValueExpression globalOnly) {
157 this.globalOnly = globalOnly;
158 }
159
160 public String getFor() {
161 return forComponent;
162 }
163
164 public void setFor(final String forComponent) {
165 this.forComponent = forComponent;
166 }
167
168 public javax.el.ValueExpression getMaxSeverity() {
169 return maxSeverity;
170 }
171
172 public void setMaxSeverity(final javax.el.ValueExpression maxSeverity) {
173 this.maxSeverity = maxSeverity;
174 }
175
176 public javax.el.ValueExpression getMinSeverity() {
177 return minSeverity;
178 }
179
180 public void setMinSeverity(final javax.el.ValueExpression minSeverity) {
181 this.minSeverity = minSeverity;
182 }
183
184 public javax.el.ValueExpression getConfirmation() {
185 return confirmation;
186 }
187
188 public void setConfirmation(final javax.el.ValueExpression confirmation) {
189 this.confirmation = confirmation;
190 }
191
192 public javax.el.ValueExpression getShowDetail() {
193 return showDetail;
194 }
195
196 public void setShowDetail(final javax.el.ValueExpression showDetail) {
197 this.showDetail = showDetail;
198 }
199
200 public javax.el.ValueExpression getMaxNumber() {
201 return maxNumber;
202 }
203
204 public void setMaxNumber(final javax.el.ValueExpression maxNumber) {
205 this.maxNumber = maxNumber;
206 }
207
208
209
210 @Override
211 public void release() {
212 super.release();
213 markup = null;
214 orderBy = null;
215 showSummary = null;
216 globalOnly = null;
217 forComponent = null;
218 maxSeverity = null;
219 minSeverity = null;
220 confirmation = null;
221 showDetail = null;
222 maxNumber = null;
223 }
224 }