Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/w3c/dom/events/Event.java
86410 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/*25* This file is available under and governed by the GNU General Public26* License version 2 only, as published by the Free Software Foundation.27* However, the following notice accompanied the original version of this28* file and, per its terms, should not be removed:29*30* Copyright (c) 2000 World Wide Web Consortium,31* (Massachusetts Institute of Technology, Institut National de32* Recherche en Informatique et en Automatique, Keio University). All33* Rights Reserved. This program is distributed under the W3C's Software34* Intellectual Property License. This program is distributed in the35* hope that it will be useful, but WITHOUT ANY WARRANTY; without even36* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR37* PURPOSE.38* See W3C License http://www.w3.org/Consortium/Legal/ for more details.39*/4041package org.w3c.dom.events;4243/**44* The <code>Event</code> interface is used to provide contextual information45* about an event to the handler processing the event. An object which46* implements the <code>Event</code> interface is generally passed as the47* first parameter to an event handler. More specific context information is48* passed to event handlers by deriving additional interfaces from49* <code>Event</code> which contain information directly relating to the50* type of event they accompany. These derived interfaces are also51* implemented by the object passed to the event listener.52* <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>.53* @since DOM Level 254*/55public interface Event {56// PhaseType57/**58* The current event phase is the capturing phase.59*/60public static final short CAPTURING_PHASE = 1;61/**62* The event is currently being evaluated at the target63* <code>EventTarget</code>.64*/65public static final short AT_TARGET = 2;66/**67* The current event phase is the bubbling phase.68*/69public static final short BUBBLING_PHASE = 3;7071/**72* The name of the event (case-insensitive). The name must be an XML name.73*/74public String getType();7576/**77* Used to indicate the <code>EventTarget</code> to which the event was78* originally dispatched.79*/80public EventTarget getTarget();8182/**83* Used to indicate the <code>EventTarget</code> whose84* <code>EventListeners</code> are currently being processed. This is85* particularly useful during capturing and bubbling.86*/87public EventTarget getCurrentTarget();8889/**90* Used to indicate which phase of event flow is currently being91* evaluated.92*/93public short getEventPhase();9495/**96* Used to indicate whether or not an event is a bubbling event. If the97* event can bubble the value is true, else the value is false.98*/99public boolean getBubbles();100101/**102* Used to indicate whether or not an event can have its default action103* prevented. If the default action can be prevented the value is true,104* else the value is false.105*/106public boolean getCancelable();107108/**109* Used to specify the time (in milliseconds relative to the epoch) at110* which the event was created. Due to the fact that some systems may111* not provide this information the value of <code>timeStamp</code> may112* be not available for all events. When not available, a value of 0113* will be returned. Examples of epoch time are the time of the system114* start or 0:0:0 UTC 1st January 1970.115*/116public long getTimeStamp();117118/**119* The <code>stopPropagation</code> method is used prevent further120* propagation of an event during event flow. If this method is called121* by any <code>EventListener</code> the event will cease propagating122* through the tree. The event will complete dispatch to all listeners123* on the current <code>EventTarget</code> before event flow stops. This124* method may be used during any stage of event flow.125*/126public void stopPropagation();127128/**129* If an event is cancelable, the <code>preventDefault</code> method is130* used to signify that the event is to be canceled, meaning any default131* action normally taken by the implementation as a result of the event132* will not occur. If, during any stage of event flow, the133* <code>preventDefault</code> method is called the event is canceled.134* Any default action associated with the event will not occur. Calling135* this method for a non-cancelable event has no effect. Once136* <code>preventDefault</code> has been called it will remain in effect137* throughout the remainder of the event's propagation. This method may138* be used during any stage of event flow.139*/140public void preventDefault();141142/**143* The <code>initEvent</code> method is used to initialize the value of an144* <code>Event</code> created through the <code>DocumentEvent</code>145* interface. This method may only be called before the146* <code>Event</code> has been dispatched via the147* <code>dispatchEvent</code> method, though it may be called multiple148* times during that phase if necessary. If called multiple times the149* final invocation takes precedence. If called from a subclass of150* <code>Event</code> interface only the values specified in the151* <code>initEvent</code> method are modified, all other attributes are152* left unchanged.153* @param eventTypeArg Specifies the event type. This type may be any154* event type currently defined in this specification or a new event155* type.. The string must be an XML name. Any new event type must not156* begin with any upper, lower, or mixed case version of the string157* "DOM". This prefix is reserved for future DOM event sets. It is158* also strongly recommended that third parties adding their own159* events use their own prefix to avoid confusion and lessen the160* probability of conflicts with other new events.161* @param canBubbleArg Specifies whether or not the event can bubble.162* @param cancelableArg Specifies whether or not the event's default163* action can be prevented.164*/165public void initEvent(String eventTypeArg,166boolean canBubbleArg,167boolean cancelableArg);168169}170171172