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 import org.w3c.dom.DOMException; 16 17 /** 18 * The <code>DocumentEvent</code> interface provides a mechanism by which the 19 * user can create an Event of a type supported by the implementation. It is 20 * expected that the <code>DocumentEvent</code> interface will be 21 * implemented on the same object which implements the <code>Document</code> 22 * interface in an implementation which supports the Event model. 23 * <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>. 24 * @since DOM Level 2 25 */ 26 public interface DocumentEvent { 27 /** 28 * 29 * @param eventType The <code>eventType</code> parameter specifies the 30 * type of <code>Event</code> interface to be created. If the 31 * <code>Event</code> interface specified is supported by the 32 * implementation this method will return a new <code>Event</code> of 33 * the interface type requested. If the <code>Event</code> is to be 34 * dispatched via the <code>dispatchEvent</code> method the 35 * appropriate event init method must be called after creation in 36 * order to initialize the <code>Event</code>'s values. As an example, 37 * a user wishing to synthesize some kind of <code>UIEvent</code> 38 * would call <code>createEvent</code> with the parameter "UIEvents". 39 * The <code>initUIEvent</code> method could then be called on the 40 * newly created <code>UIEvent</code> to set the specific type of 41 * UIEvent to be dispatched and set its context information.The 42 * <code>createEvent</code> method is used in creating 43 * <code>Event</code>s when it is either inconvenient or unnecessary 44 * for the user to create an <code>Event</code> themselves. In cases 45 * where the implementation provided <code>Event</code> is 46 * insufficient, users may supply their own <code>Event</code> 47 * implementations for use with the <code>dispatchEvent</code> method. 48 * @return The newly created <code>Event</code> 49 * @exception DOMException 50 * NOT_SUPPORTED_ERR: Raised if the implementation does not support the 51 * type of <code>Event</code> interface requested 52 */ 53 public Event createEvent(String eventType) 54 throws DOMException; 55 56 } 57