KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > event > ExoActionEvent


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.core.event;
6
7 import java.util.Map JavaDoc;
8 import java.util.HashMap JavaDoc;
9 import java.util.ResourceBundle JavaDoc;
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 /**
15  * Wed, Dec 22, 2003 @ 22:50
16  * @author: Tuan Nguyen
17  * @email: tuan08@users.sourceforge.net
18  * @version: $Id: ExoActionEvent.java,v 1.9 2004/09/24 03:10:19 tuan08 Exp $
19  */

20 public class ExoActionEvent extends ActionEvent {
21   private String JavaDoc action_ ;
22   protected Map JavaDoc params_ ;
23   protected ResourceBundle JavaDoc res_ ;
24
25   public ExoActionEvent(UIComponent source, String JavaDoc action) {
26     super(source) ;
27     action_ = action ;
28   }
29   
30   public ExoActionEvent(UIComponent source, String JavaDoc action, Map JavaDoc params) {
31     this(source, action) ;
32     params_ = params ;
33   }
34   
35   public String JavaDoc getAction() { return action_ ; }
36   
37   public void addParameter(String JavaDoc name, String JavaDoc value) {
38     if(params_ == null) params_ = new HashMap JavaDoc(5) ;
39     params_.put(name, value) ;
40   }
41   
42   public String JavaDoc getParameter(String JavaDoc name) {
43     return (String JavaDoc) params_.get(name) ;
44   }
45   
46   public String JavaDoc[] getParameterValues(String JavaDoc name) {
47     FacesContext context = FacesContext.getCurrentInstance() ;
48     Map JavaDoc paramMap = context.getExternalContext().getRequestParameterValuesMap() ;
49     return (String JavaDoc[]) paramMap.get(name) ;
50   }
51   
52   public boolean isAppropriateListener(FacesListener listener) {
53     return ((ExoActionListener) listener).canHandleAction(action_) ;
54   }
55   
56   public Map JavaDoc 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 JavaDoc getApplicationResourceBundle() {
64     if(res_ == null) {
65       res_ = Util.getApplicationResourceBundle() ;
66     }
67     return res_ ;
68   }
69 }
Popular Tags