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      minSeverity,
54      maxNumber,
55      markup,
56      customClass,
57      orderBy,
58      style,
59      confirmation,
60      maxSeverity,
61    }
62  
63    public String getFamily() {
64      return COMPONENT_FAMILY;
65    }
66  
67  
68    /**
69    Sets the mininum severity to be shown. E. g. "warn" shows only "warn", "error" and "fatal".
70    <br>Default: <code>info</code>
71    */
72    public javax.faces.application.FacesMessage.Severity getMinSeverity() {
73      javax.faces.application.FacesMessage.Severity minSeverity = (javax.faces.application.FacesMessage.Severity) getStateHelper().eval(PropertyKeys.minSeverity);
74      if (minSeverity != null) {
75        return minSeverity;
76      }
77      return javax.faces.application.FacesMessage.SEVERITY_INFO;
78    }
79  
80    public void setMinSeverity(javax.faces.application.FacesMessage.Severity minSeverity) {
81      getStateHelper().put(PropertyKeys.minSeverity, minSeverity);
82    }
83  
84    /**
85    Sets the maximum number of messages to show.
86    <br>Default: <code>2147483647</code>
87    */
88    public java.lang.Integer getMaxNumber() {
89      Number value  = (Number) getStateHelper().eval(PropertyKeys.maxNumber);
90      if (value != null) {
91        return value.intValue();
92      }
93      return 2147483647;
94    }
95  
96    public void setMaxNumber(java.lang.Integer maxNumber) {
97      getStateHelper().put(PropertyKeys.maxNumber, maxNumber);
98    }
99  
100   public org.apache.myfaces.tobago.context.Markup getMarkup() {
101     Object object = getStateHelper().eval(PropertyKeys.markup);
102     if (object != null) {
103       return Markup.valueOf(object);
104     }
105     return null;
106   }
107 
108   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
109     getStateHelper().put(PropertyKeys.markup, markup);
110   }
111 
112   /**
113   Sets a CSS class in its parent, if the parent supports it.
114 
115    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
116 
117    <pre>
118    &lt;tc:in&gt;
119      &lt;tc:style customClass="my-emphasized"/&gt;
120    &lt;/tc:in&gt;
121    </pre>
122 
123    One capability is, to used external CSS libs.
124    <br>
125    This feature should not be used imprudent.
126    Because it might be unstable against changes in the renderered HTML code.
127 
128   */
129   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
130     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
131   }
132 
133   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
134     getStateHelper().put(PropertyKeys.customClass, customClass);
135   }
136 
137   /**
138   Sets the order of the messages.
139   <br>Default: <code>occurrence</code><br>Allowed Values: <code>occurrence,severity</code>
140   */
141   public org.apache.myfaces.tobago.layout.OrderBy getOrderBy() {
142     org.apache.myfaces.tobago.layout.OrderBy orderBy = (org.apache.myfaces.tobago.layout.OrderBy) getStateHelper().eval(PropertyKeys.orderBy);
143     if (orderBy != null) {
144       return orderBy;
145     }
146     return org.apache.myfaces.tobago.layout.OrderBy.occurrence;
147   }
148 
149   public void setOrderBy(org.apache.myfaces.tobago.layout.OrderBy orderBy) {
150     getStateHelper().put(PropertyKeys.orderBy, orderBy);
151   }
152 
153   /**
154   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
155 
156   */
157   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
158     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
159   }
160 
161   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
162     getStateHelper().put(PropertyKeys.style, style);
163   }
164 
165   /**
166   Has the user to confirm this message?
167    This attributes handles the case, if the application wants to warn the user about a problem,
168    and the user has to confirm the message before he/she can continue.
169   <br>Default: <code>false</code>
170   */
171   public boolean isConfirmation() {
172     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.confirmation);
173     if (bool != null) {
174       return bool;
175     }
176     return false;
177   }
178 
179   public void setConfirmation(boolean confirmation) {
180     getStateHelper().put(PropertyKeys.confirmation, confirmation);
181   }
182 
183   /**
184   Sets the maximum severity to be shown. E. g. "warn" shows only "warn" and "info".
185    When setting this attribute you usually shoud take care, that you have a second message tag to show the
186    higher severity levels.
187   <br>Default: <code>fatal</code>
188   */
189   public javax.faces.application.FacesMessage.Severity getMaxSeverity() {
190     javax.faces.application.FacesMessage.Severity maxSeverity = (javax.faces.application.FacesMessage.Severity) getStateHelper().eval(PropertyKeys.maxSeverity);
191     if (maxSeverity != null) {
192       return maxSeverity;
193     }
194     return javax.faces.application.FacesMessage.SEVERITY_FATAL;
195   }
196 
197   public void setMaxSeverity(javax.faces.application.FacesMessage.Severity maxSeverity) {
198     getStateHelper().put(PropertyKeys.maxSeverity, maxSeverity);
199   }
200 
201 
202 }