View Javadoc

1   /*
2    * $Id: KeyPressEvent.java,v 1.18 2011/06/16 09:29:40 jbmeslin Exp $
3    * 
4    */
5   package org.rcfaces.core.event;
6   
7   import javax.faces.component.UIComponent;
8   import javax.faces.event.ActionEvent;
9   import javax.faces.event.FacesListener;
10  
11  /**
12   * @author Olivier Oeuillot (latest modification by $Author: jbmeslin $)
13   * @version $Revision: 1.18 $ $Date: 2011/06/16 09:29:40 $
14   */
15  public class KeyPressEvent extends ActionEvent {
16      private static final String REVISION = "$Revision: 1.18 $";
17  
18      private static final long serialVersionUID = 2531722435621838354L;
19  
20      private int keyCode;
21  
22      private int modifiers;
23  
24      public KeyPressEvent(UIComponent component, int keyCode, int modifiers) {
25          super(component);
26  
27          this.keyCode = keyCode;
28          this.modifiers = modifiers;
29      }
30  
31      /*
32       * (non-Javadoc)
33       * 
34       * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
35       */
36      public boolean isAppropriateListener(FacesListener listener) {
37          return (listener instanceof IKeyPressListener);
38      }
39  
40      /*
41       * (non-Javadoc)
42       * 
43       * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
44       */
45      public void processListener(FacesListener listener) {
46          ((IKeyPressListener) listener).processKeyPress(this);
47      }
48  
49      public final int getKeyCode() {
50          return keyCode;
51      }
52  
53      public final int getModifiers() {
54          return modifiers;
55      }
56  
57  }