View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package javax.faces.convert;
20  
21  import javax.el.ValueExpression;
22  import javax.faces.application.FacesMessage;
23  import javax.faces.application.FacesMessage.Severity;
24  import javax.faces.context.FacesContext;
25  
26  /** 
27   * This class encapsulates a FacesMessage to evaluate the label
28   * expression on render response, where f:loadBundle is available
29   *
30   * @author Leonardo Uribe (latest modification by $Author: skitching $)
31   * @version $Revision: 676298 $ $Date: 2008-07-13 05:31:48 -0500 (Sun, 13 Jul 2008) $
32   */
33  class _LabeledFacesMessage extends FacesMessage{
34      
35      public _LabeledFacesMessage() {
36          super();
37      }
38  
39      public _LabeledFacesMessage(Severity severity, String summary,
40              String detail, Object args[]) {
41          super(severity, summary, detail);
42          
43      }
44      
45      public _LabeledFacesMessage(Severity severity, String summary,
46              String detail) {
47          super(severity, summary, detail);
48      }
49  
50      public _LabeledFacesMessage(String summary, String detail) {
51          super(summary, detail);
52      }
53  
54      public _LabeledFacesMessage(String summary) {
55          super(summary);
56      }
57  
58      @Override
59      public String getDetail() {
60          FacesContext facesContext = FacesContext.getCurrentInstance();
61          ValueExpression value = facesContext.getApplication().getExpressionFactory().
62              createValueExpression(facesContext.getELContext(), super.getDetail(), String.class);
63          return (String) value.getValue(facesContext.getELContext());
64      }
65  
66      @Override
67      public String getSummary() {
68          FacesContext facesContext = FacesContext.getCurrentInstance();
69          ValueExpression value = facesContext.getApplication().getExpressionFactory().
70              createValueExpression(facesContext.getELContext(), super.getSummary(), String.class);
71          return (String) value.getValue(facesContext.getELContext());
72      }
73      
74  }
75