View Javadoc

1   // ---------- Attention: Generated code, please do not modify! -----------  
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.myfaces.tobago.component;
21  
22  import javax.faces.application.FacesMessage;
23  import javax.faces.context.FacesContext;
24  import org.apache.myfaces.tobago.context.Markup;
25  import org.apache.myfaces.tobago.internal.component.AbstractUIMessages;
26  import org.apache.myfaces.tobago.layout.Display;
27  import org.apache.myfaces.tobago.layout.Measure;
28  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
29  import org.apache.myfaces.tobago.internal.util.StringUtils;
30  import org.apache.myfaces.tobago.internal.util.Deprecation;
31  import org.apache.myfaces.tobago.renderkit.MarginValues;
32  import org.apache.myfaces.tobago.renderkit.SpacingValues;
33  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
34  import javax.el.ELException;
35  import javax.faces.FacesException;
36  import java.util.ArrayList;
37  import java.util.List;
38  import javax.el.MethodExpression;
39  import javax.el.ValueExpression;
40  
41  /** 
42   Renders error/validation messages.
43    * UIComponent class, generated from template {@code component2.0.stg} with class
44    * {@link org.apache.myfaces.tobago.internal.taglib.component.MessagesTagDeclaration}.
45   */
46  public class UIMessages
47      extends AbstractUIMessages implements SupportsMarkup {
48  
49    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Messages";
50  
51    public static final String COMPONENT_FAMILY = "javax.faces.Messages";
52  
53    private org.apache.myfaces.tobago.context.Markup currentMarkup;
54  
55    enum PropertyKeys {
56      markup,
57      orderBy,
58      globalOnly,
59      marginLeft,
60      minimumHeight,
61      maxSeverity,
62      minSeverity,
63      height,
64      minimumWidth,
65      confirmation,
66      rowSpan,
67      left,
68      columnSpan,
69      maximumHeight,
70      top,
71      currentWidth,
72      marginTop,
73      marginRight,
74      width,
75      preferredHeight,
76      currentHeight,
77      display,
78      maximumWidth,
79      preferredWidth,
80      marginBottom,
81      verticalIndex,
82      horizontalIndex,
83      maxNumber,
84    }
85  
86    public String getFamily() {
87      return COMPONENT_FAMILY;
88    }
89  
90  
91    public org.apache.myfaces.tobago.context.Markup getMarkup() {
92      Object object = getStateHelper().eval(PropertyKeys.markup);
93      if (object != null) {
94        return Markup.valueOf(object);
95      }
96      return null;
97    }
98  
99    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
100     getStateHelper().put(PropertyKeys.markup, markup);
101   }
102 
103   /**
104   Sets the order of the messages.
105   <br />Default: <code>occurrence</code><br />Allowed Values: <code>occurrence,severity</code>
106   */
107   public org.apache.myfaces.tobago.component.UIMessages.OrderBy getOrderBy() {
108     org.apache.myfaces.tobago.component.UIMessages.OrderBy orderBy = (org.apache.myfaces.tobago.component.UIMessages.OrderBy) getStateHelper().eval(PropertyKeys.orderBy);
109     if (orderBy != null) {
110       return orderBy;
111     }
112     return org.apache.myfaces.tobago.internal.component.AbstractUIMessages.OrderBy.OCCURRENCE;
113   }
114 
115   public void setOrderBy(org.apache.myfaces.tobago.component.UIMessages.OrderBy orderBy) {
116     getStateHelper().put(PropertyKeys.orderBy, orderBy);
117   }
118 
119   /**
120   Flag indicating that only messages that are not associated to any
121    particular UIComponent should be displayed. That are messages without clientId.
122   <br />Default: <code>false</code>
123   */
124   public java.lang.String getGlobalOnly() {
125     java.lang.String globalOnly = (java.lang.String) getStateHelper().eval(PropertyKeys.globalOnly);
126     if (globalOnly != null) {
127       return globalOnly;
128     }
129     return "false";
130   }
131 
132   public void setGlobalOnly(java.lang.String globalOnly) {
133     getStateHelper().put(PropertyKeys.globalOnly, globalOnly);
134   }
135 
136   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
137     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
138     if (object != null) {
139        return Measure.valueOf(object);
140     }
141     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
142   }
143 
144   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
145     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
146   }
147 
148   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
149     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
150     if (object != null) {
151        return Measure.valueOf(object);
152     }
153     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
154   }
155 
156   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
157     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
158   }
159 
160   /**
161   Sets the maximum severity to be shown. E. g. "warn" shows only "warn" and "info".
162    When setting this attribute you usually shoud take care, that you have a second message tag to show the
163    higher severity levels.
164   <br />Default: <code>fatal</code>
165   */
166   public javax.faces.application.FacesMessage.Severity getMaxSeverity() {
167     javax.faces.application.FacesMessage.Severity maxSeverity = (javax.faces.application.FacesMessage.Severity) getStateHelper().eval(PropertyKeys.maxSeverity);
168     if (maxSeverity != null) {
169       return maxSeverity;
170     }
171     return javax.faces.application.FacesMessage.SEVERITY_FATAL;
172   }
173 
174   public void setMaxSeverity(javax.faces.application.FacesMessage.Severity maxSeverity) {
175     getStateHelper().put(PropertyKeys.maxSeverity, maxSeverity);
176   }
177 
178   /**
179   Sets the mininum severity to be shown. E. g. "warn" shows only "warn", "error" and "fatal".
180   <br />Default: <code>info</code>
181   */
182   public javax.faces.application.FacesMessage.Severity getMinSeverity() {
183     javax.faces.application.FacesMessage.Severity minSeverity = (javax.faces.application.FacesMessage.Severity) getStateHelper().eval(PropertyKeys.minSeverity);
184     if (minSeverity != null) {
185       return minSeverity;
186     }
187     return javax.faces.application.FacesMessage.SEVERITY_INFO;
188   }
189 
190   public void setMinSeverity(javax.faces.application.FacesMessage.Severity minSeverity) {
191     getStateHelper().put(PropertyKeys.minSeverity, minSeverity);
192   }
193 
194   /**
195   This value will usually be set by the layout manager.
196 
197   */
198   public org.apache.myfaces.tobago.layout.Measure getHeight() {
199     Object object = getStateHelper().eval(PropertyKeys.height);
200     if (object != null) {
201        return Measure.valueOf(object);
202     }
203     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
204   }
205 
206   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
207     getStateHelper().put(PropertyKeys.height, height);
208   }
209 
210   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
211     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
212     if (object != null) {
213        return Measure.valueOf(object);
214     }
215     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
216   }
217 
218   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
219     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
220   }
221 
222   /**
223   Has the user to confirm this message?
224    This attributes handles the case, if the application wants to warn the user about a problem,
225    and the user has to confirm the message before he/she can continue.
226   <br />Default: <code>false</code>
227   */
228   public boolean isConfirmation() {
229     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.confirmation);
230     if (bool != null) {
231       return bool;
232     }
233     return false;
234   }
235 
236   public void setConfirmation(boolean confirmation) {
237     getStateHelper().put(PropertyKeys.confirmation, confirmation);
238   }
239 
240   public java.lang.Integer getRowSpan() {
241     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
242     if (value != null) {
243       return value.intValue();
244     }
245     return 1;
246   }
247 
248   public void setRowSpan(java.lang.Integer rowSpan) {
249     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
250   }
251 
252   /**
253   This value will usually be set by the layout manager.
254 
255   */
256   public org.apache.myfaces.tobago.layout.Measure getLeft() {
257     Object object = getStateHelper().eval(PropertyKeys.left);
258     if (object != null) {
259        return Measure.valueOf(object);
260     }
261     return null;
262   }
263 
264   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
265     getStateHelper().put(PropertyKeys.left, left);
266   }
267 
268   public java.lang.Integer getColumnSpan() {
269     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
270     if (value != null) {
271       return value.intValue();
272     }
273     return 1;
274   }
275 
276   public void setColumnSpan(java.lang.Integer columnSpan) {
277     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
278   }
279 
280   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
281     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
282     if (object != null) {
283        return Measure.valueOf(object);
284     }
285     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
286   }
287 
288   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
289     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
290   }
291 
292   /**
293   This value will usually be set by the layout manager.
294 
295   */
296   public org.apache.myfaces.tobago.layout.Measure getTop() {
297     Object object = getStateHelper().eval(PropertyKeys.top);
298     if (object != null) {
299        return Measure.valueOf(object);
300     }
301     return null;
302   }
303 
304   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
305     getStateHelper().put(PropertyKeys.top, top);
306   }
307 
308   /**
309   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
310 
311   */
312   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
313     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
314     if (object != null) {
315        return Measure.valueOf(object);
316     }
317     return getWidth();
318   }
319 
320   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
321     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
322   }
323 
324   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
325     Object object = getStateHelper().eval(PropertyKeys.marginTop);
326     if (object != null) {
327        return Measure.valueOf(object);
328     }
329     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
330   }
331 
332   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
333     getStateHelper().put(PropertyKeys.marginTop, marginTop);
334   }
335 
336   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
337     Object object = getStateHelper().eval(PropertyKeys.marginRight);
338     if (object != null) {
339        return Measure.valueOf(object);
340     }
341     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
342   }
343 
344   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
345     getStateHelper().put(PropertyKeys.marginRight, marginRight);
346   }
347 
348   /**
349   This value will usually be set by the layout manager.
350 
351   */
352   public org.apache.myfaces.tobago.layout.Measure getWidth() {
353     Object object = getStateHelper().eval(PropertyKeys.width);
354     if (object != null) {
355        return Measure.valueOf(object);
356     }
357     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
358   }
359 
360   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
361     getStateHelper().put(PropertyKeys.width, width);
362   }
363 
364   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
365     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
366     if (object != null) {
367        return Measure.valueOf(object);
368     }
369     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
370   }
371 
372   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
373     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
374   }
375 
376   /**
377   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
378 
379   */
380   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
381     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
382     if (object != null) {
383        return Measure.valueOf(object);
384     }
385     return getHeight();
386   }
387 
388   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
389     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
390   }
391 
392   /**
393   This attribute is for internal use only.
394 
395   */
396   public org.apache.myfaces.tobago.layout.Display getDisplay() {
397     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
398   }
399 
400   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
401     getStateHelper().put(PropertyKeys.display, display);
402   }
403 
404   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
405     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
406     if (object != null) {
407        return Measure.valueOf(object);
408     }
409     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
410   }
411 
412   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
413     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
414   }
415 
416   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
417     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
418     if (object != null) {
419        return Measure.valueOf(object);
420     }
421     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
422   }
423 
424   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
425     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
426   }
427 
428   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
429     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
430     if (object != null) {
431        return Measure.valueOf(object);
432     }
433     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
434   }
435 
436   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
437     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
438   }
439 
440   /**
441   This attribute is for internal use only.
442 
443   */
444   public java.lang.Integer getVerticalIndex() {
445     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
446     if (value != null) {
447       return value.intValue();
448     }
449     return null;
450   }
451 
452   public void setVerticalIndex(java.lang.Integer verticalIndex) {
453     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
454   }
455 
456   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
457     if (currentMarkup != null) {
458       return currentMarkup;
459     }
460     return null;
461   }
462 
463   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
464     this.currentMarkup = currentMarkup;
465   }
466 
467   /**
468   This attribute is for internal use only.
469 
470   */
471   public java.lang.Integer getHorizontalIndex() {
472     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
473     if (value != null) {
474       return value.intValue();
475     }
476     return null;
477   }
478 
479   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
480     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
481   }
482 
483   /**
484   Sets the maximum number of messages to show.
485   <br />Default: <code>2147483647</code>
486   */
487   public java.lang.Integer getMaxNumber() {
488     Number value  = (Number) getStateHelper().eval(PropertyKeys.maxNumber);
489     if (value != null) {
490       return value.intValue();
491     }
492     return 2147483647;
493   }
494 
495   public void setMaxNumber(java.lang.Integer maxNumber) {
496     getStateHelper().put(PropertyKeys.maxNumber, maxNumber);
497   }
498 
499   public Object saveState(FacesContext context) {
500     currentMarkup = null;
501     return super.saveState(context);
502   }
503 
504 }