1 5 package org.exoplatform.faces.core.event; 6 7 import java.util.Map ; 8 import java.util.HashMap ; 9 import java.util.ResourceBundle ; 10 import javax.faces.component.UIComponent; 11 import javax.faces.context.FacesContext; 12 import javax.faces.event.*; 13 import org.exoplatform.faces.core.Util; 14 20 public class ExoActionEvent extends ActionEvent { 21 private String action_ ; 22 protected Map params_ ; 23 protected ResourceBundle res_ ; 24 25 public ExoActionEvent(UIComponent source, String action) { 26 super(source) ; 27 action_ = action ; 28 } 29 30 public ExoActionEvent(UIComponent source, String action, Map params) { 31 this(source, action) ; 32 params_ = params ; 33 } 34 35 public String getAction() { return action_ ; } 36 37 public void addParameter(String name, String value) { 38 if(params_ == null) params_ = new HashMap (5) ; 39 params_.put(name, value) ; 40 } 41 42 public String getParameter(String name) { 43 return (String ) params_.get(name) ; 44 } 45 46 public String [] getParameterValues(String name) { 47 FacesContext context = FacesContext.getCurrentInstance() ; 48 Map paramMap = context.getExternalContext().getRequestParameterValuesMap() ; 49 return (String []) paramMap.get(name) ; 50 } 51 52 public boolean isAppropriateListener(FacesListener listener) { 53 return ((ExoActionListener) listener).canHandleAction(action_) ; 54 } 55 56 public Map getParameterMap() { return params_ ; } 57 58 public void processListener(FacesListener listener) throws AbortProcessingException { 59 ExoActionListener exoListener = (ExoActionListener) listener ; 60 exoListener.processAction(this) ; 61 } 62 63 public ResourceBundle getApplicationResourceBundle() { 64 if(res_ == null) { 65 res_ = Util.getApplicationResourceBundle() ; 66 } 67 return res_ ; 68 } 69 } | Popular Tags |