1 5 package org.exoplatform.faces.application; 6 7 import java.text.MessageFormat ; 8 import java.util.ResourceBundle ; 9 import javax.faces.application.FacesMessage; 10 import org.exoplatform.commons.utils.ExpressionUtil; 11 16 public class ExoFacesMessage extends FacesMessage { 17 private Object [] args_ ; 18 19 public ExoFacesMessage(FacesMessage.Severity severity, String summary, String detail) { 20 super(severity, summary, detail) ; 21 } 22 23 public ExoFacesMessage(FacesMessage.Severity severity, String summary, String detail, Object [] args) { 24 super(severity, summary, detail) ; 25 args_ = args ; 26 } 27 28 public ExoFacesMessage(String summary, String detail) { 29 super(summary, detail) ; 30 } 31 32 public ExoFacesMessage(String summary, String detail, Object [] args) { 33 super(summary, detail) ; 34 args_ = args ; 35 } 36 37 38 public ExoFacesMessage(String summary) { 39 super(summary) ; 40 } 41 42 public ExoFacesMessage(String summary, Object [] args) { 43 super(summary) ; 44 args_ = args ; 45 } 46 47 public String getSummary(ResourceBundle res) { 48 String s = ExpressionUtil.getExpressionValue(res, getSummary()) ; 49 if(args_ != null) s = MessageFormat.format(s, args_) ; 50 return s ; 51 } 52 53 public String getDetail(ResourceBundle res) { 54 String s = ExpressionUtil.getExpressionValue(res, getSummary()) ; 55 if(args_ != null) s = MessageFormat.format(s, args_) ; 56 return s ; 57 } 58 } | Popular Tags |