Package org.w3c.dom.events
Interface DocumentEvent
-
- All Known Implementing Classes:
AbstractDocument,AbstractStylableDocument,GenericDocument,SVG12OMDocument,SVGOMDocument,SVGOMSVGElement
public interface DocumentEventTheDocumentEventinterface provides a mechanism by which the user can create anEventobject of a type supported by the implementation. If the feature "Events" is supported by theDocumentobject, theDocumentEventinterface must be implemented on the same object. If the feature "+Events" is supported by theDocumentobject, an object that supports theDocumentEventinterface must be returned by invoking the methodNode.getFeature("+Events", "3.0")on theDocumentobject.See also the Document Object Model (DOM) Level 3 Events Specification .
- Since:
- DOM Level 2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanDispatch(java.lang.String namespaceURI, java.lang.String type)Test if the implementation can generate events of a specified type.EventcreateEvent(java.lang.String eventType)
-
-
-
Method Detail
-
createEvent
Event createEvent(java.lang.String eventType) throws org.w3c.dom.DOMException
- Parameters:
eventType- TheeventTypeparameter 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 theEventis to be dispatched via theEventTarget.dispatchEvent()method the appropriate event init method must be called after creation in order to initialize theEvent's values. As an example, a user wishing to synthesize some kind ofUIEventwould invokeDocumentEvent.createEvent("UIEvent"). TheUIEvent.initUIEventNS()method could then be called on the newly createdUIEventobject to set the specific type of user interface event to be dispatched, DOMActivate for example, and set its context information, e.g.UIEvent.detailin this example.Note: For backward compatibility reason, "UIEvents", "MouseEvents", "MutationEvents", and "HTMLEvents" feature names are valid values for the parameter
eventTypeand represent respectively the interfaces "UIEvent", "MouseEvent", "MutationEvent", and "Event".- Returns:
- The newly created event object.
- Throws:
org.w3c.dom.DOMException- NOT_SUPPORTED_ERR: Raised if the implementation does not support theEventinterface requested.
-
canDispatch
boolean canDispatch(java.lang.String namespaceURI, java.lang.String type)Test if the implementation can generate events of a specified type.- Parameters:
namespaceURI- Specifies theEvent.namespaceURIof the event.type- Specifies theEvent.typeof the event.- Returns:
trueif the implementation can generate and dispatch this event type,falseotherwise.- Since:
- DOM Level 3
-
-