org.w3c.dom.events.DocumentEvent Maven / Gradle / Ivy
/*
* Portions Copyright 2000-2008 Sun Microsystems, Inc. All Rights
* Reserved. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
/*
* Copyright (c) 2006 World Wide Web Consortium,
*
* (Massachusetts Institute of Technology, European Research Consortium for
* Informatics and Mathematics, Keio University). All Rights Reserved. This
* work is distributed under the W3C(r) Software License [1] in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
package org.w3c.dom.events;
import org.w3c.dom.DOMException;
/**
* The DocumentEvent
interface provides a mechanism by which the
* user can create an Event
object of a type supported by the
* implementation. If the feature "Events" is supported by the
* Document
object, the DocumentEvent
interface
* must be implemented on the same object.
* Note that JSR 280 does not support the 3.0 Events feature, but the object
* returned to a 2.0 Events request will include the DocumentEvent interface
* implementation.
* See also the
*
* Document Object Model (DOM) Level 3 Events Specification.
*
* @since DOM Level 2
*/
public interface DocumentEvent {
/**
* Create an Event.
*
* @param eventType The eventType
parameter specifies the
* name of the DOM Events interface to be supported by the created
* event object, e.g. "Event"
, "MouseEvent"
,
* "MutationEvent"
and so on. If the Event
* is to be dispatched via the EventTarget.dispatchEvent()
* method the appropriate event init method must be called after
* creation in order to initialize the Event
's values.
* As an example, a user wishing to synthesize some kind of
* UIEvent
would invoke
* DocumentEvent.createEvent("UIEvent")
. The
* UIEvent.initUIEventNS()
method could then be called on
* the newly created UIEvent
object to set the specific
* type of user interface event to be dispatched, DOMActivate for
* example, and set its context information, e.g.
* UIEvent.detail
in this example.
*
Note: For backward compatibility reason, "UIEvents",
* "MouseEvents", "MutationEvents", and "HTMLEvents" feature names are
* valid values for the parameter eventType
and represent
* respectively the interfaces "UIEvent", "MouseEvent",
* "MutationEvent", and "Event".
*
Note: JSR 280 follows the DOM 3 rule for Event.type
* and considers it to be case-sensitive. This differs from DOM 2, which
* considers it to be case-insensitive.
* @return The newly created event object.
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised if the implementation does not support the
* Event
interface requested.
*/
public Event createEvent(String eventType)
throws DOMException;
/**
* Test if the implementation can generate events of a specified type.
* @param namespaceURI Specifies the Event.namespaceURI
of
* the event, may be null.
* @param type Specifies the Event.type
of the event.
* @return true
if the implementation can generate and
* dispatch this event type, false
otherwise.
*
* @since DOM Level 3
*/
public boolean canDispatch(String namespaceURI, String type);
}