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.OrderBy;
27  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
28  import org.apache.myfaces.tobago.renderkit.css.Style;
29  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
30  import org.apache.myfaces.tobago.internal.util.StringUtils;
31  import org.apache.myfaces.tobago.internal.util.Deprecation;
32  import javax.el.ELException;
33  import javax.faces.FacesException;
34  import java.util.ArrayList;
35  import java.util.List;
36  import javax.el.MethodExpression;
37  import javax.el.ValueExpression;
38  
39  /** 
40   Renders error/validation messages.
41    * UIComponent class, generated from template {@code component.stg} with class
42    * {@link org.apache.myfaces.tobago.internal.taglib.component.MessagesTagDeclaration}.
43   */
44  public class UIMessages
45      extends AbstractUIMessages implements Visual {
46  
47    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Messages";
48  
49    public static final String COMPONENT_FAMILY = "javax.faces.Messages";
50  
51  
52    enum PropertyKeys {
53      globalOnly,
54      minSeverity,
55      maxNumber,
56      markup,
57      customClass,
58      orderBy,
59      style,
60      confirmation,
61      maxSeverity,
62    }
63  
64    public String getFamily() {
65      return COMPONENT_FAMILY;
66    }
67  
68  
69    /**
70    Flag indicating that only messages that are not associated to any
71     particular UIComponent should be displayed. That are messages without clientId.
72    <br>Default: <code>false</code>
73    */
74    public java.lang.String getGlobalOnly() {
75      java.lang.String globalOnly = (java.lang.String) getStateHelper().eval(PropertyKeys.globalOnly);
76      if (globalOnly != null) {
77        return globalOnly;
78      }
79      return "false";
80    }
81  
82    public void setGlobalOnly(java.lang.String globalOnly) {
83      getStateHelper().put(PropertyKeys.globalOnly, globalOnly);
84    }
85  
86    /**
87    Sets the mininum severity to be shown. E. g. "warn" shows only "warn", "error" and "fatal".
88    <br>Default: <code>info</code>
89    */
90    public javax.faces.application.FacesMessage.Severity getMinSeverity() {
91      javax.faces.application.FacesMessage.Severity minSeverity = (javax.faces.application.FacesMessage.Severity) getStateHelper().eval(PropertyKeys.minSeverity);
92      if (minSeverity != null) {
93        return minSeverity;
94      }
95      return javax.faces.application.FacesMessage.SEVERITY_INFO;
96    }
97  
98    public void setMinSeverity(javax.faces.application.FacesMessage.Severity minSeverity) {
99      getStateHelper().put(PropertyKeys.minSeverity, minSeverity);
100   }
101 
102   /**
103   Sets the maximum number of messages to show.
104   <br>Default: <code>2147483647</code>
105   */
106   public java.lang.Integer getMaxNumber() {
107     Number value  = (Number) getStateHelper().eval(PropertyKeys.maxNumber);
108     if (value != null) {
109       return value.intValue();
110     }
111     return 2147483647;
112   }
113 
114   public void setMaxNumber(java.lang.Integer maxNumber) {
115     getStateHelper().put(PropertyKeys.maxNumber, maxNumber);
116   }
117 
118   public org.apache.myfaces.tobago.context.Markup getMarkup() {
119     Object object = getStateHelper().eval(PropertyKeys.markup);
120     if (object != null) {
121       return Markup.valueOf(object);
122     }
123     return null;
124   }
125 
126   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
127     getStateHelper().put(PropertyKeys.markup, markup);
128   }
129 
130   /**
131   Sets a CSS class in its parent, if the parent supports it.
132 
133    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
134 
135    <pre>
136    &lt;tc:in&gt;
137      &lt;tc:style customClass="my-emphasized"/&gt;
138    &lt;/tc:in&gt;
139    </pre>
140 
141    One capability is, to used external CSS libs.
142    <br>
143    This feature should not be used imprudent.
144    Because it might be unstable against changes in the renderered HTML code.
145 
146   */
147   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
148     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
149   }
150 
151   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
152     getStateHelper().put(PropertyKeys.customClass, customClass);
153   }
154 
155   /**
156   Sets the order of the messages.
157   <br>Default: <code>occurrence</code><br>Allowed Values: <code>occurrence,severity</code>
158   */
159   public org.apache.myfaces.tobago.layout.OrderBy getOrderBy() {
160     org.apache.myfaces.tobago.layout.OrderBy orderBy = (org.apache.myfaces.tobago.layout.OrderBy) getStateHelper().eval(PropertyKeys.orderBy);
161     if (orderBy != null) {
162       return orderBy;
163     }
164     return org.apache.myfaces.tobago.layout.OrderBy.occurrence;
165   }
166 
167   public void setOrderBy(org.apache.myfaces.tobago.layout.OrderBy orderBy) {
168     getStateHelper().put(PropertyKeys.orderBy, orderBy);
169   }
170 
171   /**
172   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
173 
174   */
175   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
176     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
177   }
178 
179   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
180     getStateHelper().put(PropertyKeys.style, style);
181   }
182 
183   /**
184   Has the user to confirm this message?
185    This attributes handles the case, if the application wants to warn the user about a problem,
186    and the user has to confirm the message before he/she can continue.
187   <br>Default: <code>false</code>
188   */
189   public boolean isConfirmation() {
190     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.confirmation);
191     if (bool != null) {
192       return bool;
193     }
194     return false;
195   }
196 
197   public void setConfirmation(boolean confirmation) {
198     getStateHelper().put(PropertyKeys.confirmation, confirmation);
199   }
200 
201   /**
202   Sets the maximum severity to be shown. E. g. "warn" shows only "warn" and "info".
203    When setting this attribute you usually shoud take care, that you have a second message tag to show the
204    higher severity levels.
205   <br>Default: <code>fatal</code>
206   */
207   public javax.faces.application.FacesMessage.Severity getMaxSeverity() {
208     javax.faces.application.FacesMessage.Severity maxSeverity = (javax.faces.application.FacesMessage.Severity) getStateHelper().eval(PropertyKeys.maxSeverity);
209     if (maxSeverity != null) {
210       return maxSeverity;
211     }
212     return javax.faces.application.FacesMessage.SEVERITY_FATAL;
213   }
214 
215   public void setMaxSeverity(javax.faces.application.FacesMessage.Severity maxSeverity) {
216     getStateHelper().put(PropertyKeys.maxSeverity, maxSeverity);
217   }
218 
219 
220 }