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