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