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.annotation.Generated;
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  @Generated("component.stg")
48  public class UIMessages
49      extends AbstractUIMessages implements ClientBehaviorHolder, Visual {
50  
51    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Messages";
52  
53    public static final String COMPONENT_FAMILY = "javax.faces.Messages";
54  
55  
56    enum PropertyKeys {
57      minSeverity,
58      maxNumber,
59      markup,
60      customClass,
61      orderBy,
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   Has the user to confirm this message?
158    This attributes handles the case, if the application wants to warn the user about a problem,
159    and the user has to confirm the message before he/she can continue.
160   <br>Default: <code>false</code>
161   */
162   public boolean isConfirmation() {
163     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.confirmation);
164     if (bool != null) {
165       return bool;
166     }
167     return false;
168   }
169 
170   public void setConfirmation(boolean confirmation) {
171     getStateHelper().put(PropertyKeys.confirmation, confirmation);
172   }
173 
174   /**
175   Sets the maximum severity to be shown. E. g. "warn" shows only "warn" and "info".
176    When setting this attribute you usually shoud take care, that you have a second message tag to show the
177    higher severity levels.
178   <br>Default: <code>fatal</code>
179   */
180   public javax.faces.application.FacesMessage.Severity getMaxSeverity() {
181     javax.faces.application.FacesMessage.Severity maxSeverity = (javax.faces.application.FacesMessage.Severity) getStateHelper().eval(PropertyKeys.maxSeverity);
182     if (maxSeverity != null) {
183       return maxSeverity;
184     }
185     return javax.faces.application.FacesMessage.SEVERITY_FATAL;
186   }
187 
188   public void setMaxSeverity(javax.faces.application.FacesMessage.Severity maxSeverity) {
189     getStateHelper().put(PropertyKeys.maxSeverity, maxSeverity);
190   }
191 
192 
193   @Override
194   public void restoreState(FacesContext context, Object state) {
195     // FIXME HACK for mojarra SystemEventListener state restoring bug
196     pushComponentToEL(context, this);
197     super.restoreState(context, state);
198     popComponentFromEL(context);
199   }
200 
201 }