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