com.gargoylesoftware.htmlunit.javascript.host
Class Event

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.Event
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable
Direct Known Subclasses:
MouseEvent

public class Event
extends SimpleScriptable

JavaScript object representing an Event that is passed into Event Handlers when they are invoked. For general information on which properties and functions should be supported, see the mozilla docs or the W3C DOM Level 2 Event Documentation.

Version:
$Revision: 1.3 $
Author:
Chris Eldredge, Mike Bowler, Chris Erskine, Marc Guillemot, Daniel Gredler, Brad Murray, Ahmed Ashour, Rob Di Marco
See Also:
Serialized Form

Field Summary
static java.lang.String TYPE_BLUR
 The blur event type, triggered by "onblur" event handlers.
static java.lang.String TYPE_CHANGE
 The change event type, triggered by "onchange" event handlers.
static java.lang.String TYPE_FOCUS
 The focus event type, triggered by "onfocus" event handlers.
static java.lang.String TYPE_KEY_DOWN
 The key down event type, triggered by "onkeydown" event handlers.
static java.lang.String TYPE_LOAD
 The load event type, triggered by "onload" event handlers.
static java.lang.String TYPE_RESET
 The submit event type, triggered by "onreset" event handlers.
static java.lang.String TYPE_SUBMIT
 The submit event type, triggered by "onsubmit" event handlers.
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
Event()
 Used to build the prototype
Event(DomNode domNode, java.lang.String type)
 Creates a new event instance.
Event(DomNode domNode, java.lang.String type, boolean shiftKey, boolean ctrlKey, boolean altKey)
 Creates a new event instance.
Event(DomNode domNode, java.lang.String type, int keyCode, boolean shiftKey, boolean ctrlKey, boolean altKey)
 Creates a new event instance for a keypress event.
 
Method Summary
 boolean isPropagationStopped()
 Indicates if event propagation is stopped.
 void jsxFunction_stopPropagation()
 Stops the event from propagating.
 boolean jsxGet_altKey()
  
 boolean jsxGet_cancelBubble()
  
 boolean jsxGet_ctrlKey()
  
 java.lang.Object jsxGet_currentTarget()
 Returns the event target whose event listeners are currently being processed.
 java.lang.Object jsxGet_keyCode()
 Returns the key code associated with the event.
 boolean jsxGet_shiftKey()
  
 java.lang.Object jsxGet_srcElement()
 Returns the object that fired the event.
 java.lang.Object jsxGet_target()
 Returns the event target to which the event was originally dispatched.
 java.lang.String jsxGet_type()
 Returns the event type.
 void jsxSet_cancelBubble(boolean newValue)
  
 void jsxSet_srcElement(java.lang.Object srcElement)
 Sets the object that fired the event.
 void setCurrentTarget(org.mozilla.javascript.Scriptable target)
 Sets the current target
 void setEventType(java.lang.String eventType)
 Sets the event type.
 java.lang.String toString()
 
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
get, getBooleanArg, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getHtmlElementOrDie, getHtmlElementOrNull, getIntArg, getObjectArg, getStringArg, makeScriptableFor, setDomNode, setHtmlElement
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_BLUR

public static final java.lang.String TYPE_BLUR
The blur event type, triggered by "onblur" event handlers.

See Also:
Constant Field Values

TYPE_CHANGE

public static final java.lang.String TYPE_CHANGE
The change event type, triggered by "onchange" event handlers.

See Also:
Constant Field Values

TYPE_FOCUS

public static final java.lang.String TYPE_FOCUS
The focus event type, triggered by "onfocus" event handlers.

See Also:
Constant Field Values

TYPE_KEY_DOWN

public static final java.lang.String TYPE_KEY_DOWN
The key down event type, triggered by "onkeydown" event handlers.

See Also:
Constant Field Values

TYPE_LOAD

public static final java.lang.String TYPE_LOAD
The load event type, triggered by "onload" event handlers.

See Also:
Constant Field Values

TYPE_RESET

public static final java.lang.String TYPE_RESET
The submit event type, triggered by "onreset" event handlers.

See Also:
Constant Field Values

TYPE_SUBMIT

public static final java.lang.String TYPE_SUBMIT
The submit event type, triggered by "onsubmit" event handlers.

See Also:
Constant Field Values
Constructor Detail

Event

public Event()
Used to build the prototype


Event

public Event(DomNode domNode,
             java.lang.String type)
Creates a new event instance.

Parameters:
domNode - The DOM node that triggered the event.
type - The event type.

Event

public Event(DomNode domNode,
             java.lang.String type,
             boolean shiftKey,
             boolean ctrlKey,
             boolean altKey)
Creates a new event instance.

Parameters:
domNode - The DOM node that triggered the event.
type - The event type.
shiftKey - true if SHIFT is pressed
ctrlKey - true if CTRL is pressed
altKey - true if ALT is pressed

Event

public Event(DomNode domNode,
             java.lang.String type,
             int keyCode,
             boolean shiftKey,
             boolean ctrlKey,
             boolean altKey)
Creates a new event instance for a keypress event.

Parameters:
domNode - the DOM node that triggered the event.
type - The event type.
keyCode - The key code associated with the event.
shiftKey - true if SHIFT is pressed
ctrlKey - true if CTRL is pressed
altKey - true if ALT is pressed
Method Detail

isPropagationStopped

public boolean isPropagationStopped()
Indicates if event propagation is stopped.

Returns:
the status

jsxFunction_stopPropagation

public void jsxFunction_stopPropagation()
Stops the event from propagating.


jsxGet_altKey

public boolean jsxGet_altKey()
Returns:
whether ALT has been pressed during this event or not.

jsxGet_cancelBubble

public boolean jsxGet_cancelBubble()
Returns:
indicates if event propagation is stopped.

jsxGet_ctrlKey

public boolean jsxGet_ctrlKey()
Returns:
whether CTRL has been pressed during this event or not.

jsxGet_currentTarget

public java.lang.Object jsxGet_currentTarget()
Returns the event target whose event listeners are currently being processed. This is useful during event capturing and event bubbling.

Returns:
The current event target.

jsxGet_keyCode

public java.lang.Object jsxGet_keyCode()
Returns the key code associated with the event.

Returns:
The key code associated with the event.

jsxGet_shiftKey

public boolean jsxGet_shiftKey()
Returns:
whether SHIFT has been pressed during this event or not.

jsxGet_srcElement

public java.lang.Object jsxGet_srcElement()
Returns the object that fired the event. This is an IE-only property.

Returns:
The object that fired the event.

jsxGet_target

public java.lang.Object jsxGet_target()
Returns the event target to which the event was originally dispatched.

Returns:
The event target to which the event was originally dispatched.

jsxGet_type

public java.lang.String jsxGet_type()
Returns the event type.

Returns:
The event type.

jsxSet_cancelBubble

public void jsxSet_cancelBubble(boolean newValue)
Parameters:
newValue - indicates if event propagation is stopped.

jsxSet_srcElement

public void jsxSet_srcElement(java.lang.Object srcElement)
Sets the object that fired the event. This is an IE-only property.

Parameters:
srcElement - The object that fired the event.

setCurrentTarget

public void setCurrentTarget(org.mozilla.javascript.Scriptable target)
Sets the current target

Parameters:
target - the new value

setEventType

public void setEventType(java.lang.String eventType)
Sets the event type.

Parameters:
eventType - The event type.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.