Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: jcurses/event/ActionListenerManager.java


1   package jcurses.event;
2   
3   
4   /**
5   *  This class implements a listener manager to manage <code>jcurses.event.ActionEvent</code> instances and listener
6   * on these. Only possible type of handled events is <code>jcurses.event.ActionEvent<code>,
7   * of managed listeners id <code>jcurses.event.ActionListener</code>
8   */
9   public class ActionListenerManager extends ListenerManager {
10    
11    protected void doHandleEvent(Event event, Object listener) {
12      ((ActionListener)listener).actionPerformed((ActionEvent)event);
13    }
14    
15    protected void verifyListener(Object listener) {
16      if (!(listener instanceof ActionListener)) {
17        throw new RuntimeException("illegal listener type");
18      }
19    }
20    
21    protected void verifyEvent(Event event) {
22      if (!(event instanceof ActionEvent)) {
23        throw new RuntimeException("illegal event type");
24      }
25    }
26  
27  }