001 /*
002 * Copyright (c) 2000 World Wide Web Consortium,
003 * (Massachusetts Institute of Technology, Institut National de
004 * Recherche en Informatique et en Automatique, Keio University). All
005 * Rights Reserved. This program is distributed under the W3C's Software
006 * Intellectual Property License. This program is distributed in the
007 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009 * PURPOSE.
010 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
011 */
012
013 package org.w3c.dom.events;
014
015 import org.w3c.dom.DOMException;
016
017 /**
018 * The <code>DocumentEvent</code> interface provides a mechanism by which the
019 * user can create an Event of a type supported by the implementation. It is
020 * expected that the <code>DocumentEvent</code> interface will be
021 * implemented on the same object which implements the <code>Document</code>
022 * interface in an implementation which supports the Event model.
023 * <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>.
024 * @since DOM Level 2
025 */
026 public interface DocumentEvent {
027 /**
028 *
029 * @param eventType The <code>eventType</code> parameter specifies the
030 * type of <code>Event</code> interface to be created. If the
031 * <code>Event</code> interface specified is supported by the
032 * implementation this method will return a new <code>Event</code> of
033 * the interface type requested. If the <code>Event</code> is to be
034 * dispatched via the <code>dispatchEvent</code> method the
035 * appropriate event init method must be called after creation in
036 * order to initialize the <code>Event</code>'s values. As an example,
037 * a user wishing to synthesize some kind of <code>UIEvent</code>
038 * would call <code>createEvent</code> with the parameter "UIEvents".
039 * The <code>initUIEvent</code> method could then be called on the
040 * newly created <code>UIEvent</code> to set the specific type of
041 * UIEvent to be dispatched and set its context information.The
042 * <code>createEvent</code> method is used in creating
043 * <code>Event</code>s when it is either inconvenient or unnecessary
044 * for the user to create an <code>Event</code> themselves. In cases
045 * where the implementation provided <code>Event</code> is
046 * insufficient, users may supply their own <code>Event</code>
047 * implementations for use with the <code>dispatchEvent</code> method.
048 * @return The newly created <code>Event</code>
049 * @exception DOMException
050 * NOT_SUPPORTED_ERR: Raised if the implementation does not support the
051 * type of <code>Event</code> interface requested
052 */
053 public Event createEvent(String eventType)
054 throws DOMException;
055
056 }