Home | History | Annotate | Download | only in events
      1 /*
      2  * Copyright (c) 2000 World Wide Web Consortium,
      3  * (Massachusetts Institute of Technology, Institut National de
      4  * Recherche en Informatique et en Automatique, Keio University). All
      5  * Rights Reserved. This program is distributed under the W3C's Software
      6  * Intellectual Property License. This program is distributed in the
      7  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
      8  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
      9  * PURPOSE.
     10  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
     11  */
     12 
     13 package org.w3c.dom.events;
     14 
     15 /**
     16  *  The <code>EventListener</code> interface is the primary method for
     17  * handling events. Users implement the <code>EventListener</code> interface
     18  * and register their listener on an <code>EventTarget</code> using the
     19  * <code>AddEventListener</code> method. The users should also remove their
     20  * <code>EventListener</code> from its <code>EventTarget</code> after they
     21  * have completed using the listener.
     22  * <p> When a <code>Node</code> is copied using the <code>cloneNode</code>
     23  * method the <code>EventListener</code>s attached to the source
     24  * <code>Node</code> are not attached to the copied <code>Node</code>. If
     25  * the user wishes the same <code>EventListener</code>s to be added to the
     26  * newly created copy the user must add them manually.
     27  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
     28  * @since DOM Level 2
     29  */
     30 public interface EventListener {
     31     /**
     32      *  This method is called whenever an event occurs of the type for which
     33      * the <code> EventListener</code> interface was registered.
     34      * @param evt  The <code>Event</code> contains contextual information
     35      *   about the event. It also contains the <code>stopPropagation</code>
     36      *   and <code>preventDefault</code> methods which are used in
     37      *   determining the event's flow and default action.
     38      */
     39     public void handleEvent(Event evt);
     40 
     41 }
     42