KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > application > ExoFacesMessage


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.faces.application;
6
7 import java.text.MessageFormat JavaDoc;
8 import java.util.ResourceBundle JavaDoc ;
9 import javax.faces.application.FacesMessage;
10 import org.exoplatform.commons.utils.ExpressionUtil;
11 /**
12  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
13  * @since Nov 29, 2004
14  * @version $Id$
15  */

16 public class ExoFacesMessage extends FacesMessage {
17   private Object JavaDoc[] args_ ;
18   
19   public ExoFacesMessage(FacesMessage.Severity severity, String JavaDoc summary, String JavaDoc detail) {
20     super(severity, summary, detail) ;
21   }
22   
23   public ExoFacesMessage(FacesMessage.Severity severity, String JavaDoc summary, String JavaDoc detail, Object JavaDoc[] args) {
24     super(severity, summary, detail) ;
25     args_ = args ;
26   }
27   
28   public ExoFacesMessage(String JavaDoc summary, String JavaDoc detail) {
29     super(summary, detail) ;
30   }
31   
32   public ExoFacesMessage(String JavaDoc summary, String JavaDoc detail, Object JavaDoc[] args) {
33     super(summary, detail) ;
34     args_ = args ;
35   }
36   
37
38   public ExoFacesMessage(String JavaDoc summary) {
39     super(summary) ;
40   }
41   
42   public ExoFacesMessage(String JavaDoc summary, Object JavaDoc[] args) {
43     super(summary) ;
44     args_ = args ;
45   }
46   
47   public String JavaDoc getSummary(ResourceBundle JavaDoc res) {
48     String JavaDoc s = ExpressionUtil.getExpressionValue(res, getSummary()) ;
49     if(args_ != null) s = MessageFormat.format(s, args_) ;
50     return s ;
51   }
52   
53   public String JavaDoc getDetail(ResourceBundle JavaDoc res) {
54     String JavaDoc s = ExpressionUtil.getExpressionValue(res, getSummary()) ;
55     if(args_ != null) s = MessageFormat.format(s, args_) ;
56     return s ;
57   }
58 }
Popular Tags