com.gargoylesoftware.htmlunit.javascript.host
Class EventListenersContainer

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer
All Implemented Interfaces:
Serializable

public class EventListenersContainer
extends Object
implements Serializable

Container for event listener.

Version:
$Revision: 5864 $
Author:
Marc Guillemot, Daniel Gredler, Ahmed Ashour
See Also:
Serialized Form

Method Summary
 boolean addEventListener(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener, boolean useCapture)
          Adds an event listener.
 ScriptResult executeBubblingListeners(Event event, Object[] args, Object[] propHandlerArgs)
          Executes bubbling listeners.
 ScriptResult executeCapturingListeners(Event event, Object[] args)
          Executes capturing listeners.
 ScriptResult executeListeners(Event event, Object[] args, Object[] propHandlerArgs)
          Executes listeners.
 net.sourceforge.htmlunit.corejs.javascript.Function getEventHandler(String eventName)
          Gets an event handler.
 Object getEventHandlerProp(String eventName)
          Returns event handler property.
 boolean hasEventHandlers(String eventName)
          Returns true if there are any event handlers for the specified event.
 void removeEventListener(String type, net.sourceforge.htmlunit.corejs.javascript.Function listener, boolean useCapture)
          Removes event listener.
 void setEventHandlerProp(String eventName, Object value)
          Sets the handler property (with an handler or something else).
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

addEventListener

public boolean addEventListener(String type,
                                net.sourceforge.htmlunit.corejs.javascript.Function listener,
                                boolean useCapture)
Adds an event listener.

Parameters:
type - the event type to listen for (like "load")
listener - the event listener
useCapture - If true, indicates that the user wishes to initiate capture (not yet implemented)
Returns:
true if the listener has been added

removeEventListener

public void removeEventListener(String type,
                                net.sourceforge.htmlunit.corejs.javascript.Function listener,
                                boolean useCapture)
Removes event listener.

Parameters:
type - the type
listener - the listener
useCapture - to use capture or not

setEventHandlerProp

public void setEventHandlerProp(String eventName,
                                Object value)
Sets the handler property (with an handler or something else).

Parameters:
eventName - the event name (like "click")
value - the new property

getEventHandlerProp

public Object getEventHandlerProp(String eventName)
Returns event handler property.

Parameters:
eventName - event name
Returns:
the handler, or null if not found

executeBubblingListeners

public ScriptResult executeBubblingListeners(Event event,
                                             Object[] args,
                                             Object[] propHandlerArgs)
Executes bubbling listeners.

Parameters:
event - the event
args - arguments
propHandlerArgs - handler arguments
Returns:
the result

executeCapturingListeners

public ScriptResult executeCapturingListeners(Event event,
                                              Object[] args)
Executes capturing listeners.

Parameters:
event - the event
args - the arguments
Returns:
the result

getEventHandler

public net.sourceforge.htmlunit.corejs.javascript.Function getEventHandler(String eventName)
Gets an event handler.

Parameters:
eventName - the event name (e.g. "click")
Returns:
the handler function, null if the property is null or not a function

hasEventHandlers

public boolean hasEventHandlers(String eventName)
Returns true if there are any event handlers for the specified event.

Parameters:
eventName - the event name (e.g. "click")
Returns:
true if there are any event handlers for the specified event, false otherwise

executeListeners

public ScriptResult executeListeners(Event event,
                                     Object[] args,
                                     Object[] propHandlerArgs)
Executes listeners.

Parameters:
event - the event
args - the arguments
propHandlerArgs - handler arguments
Returns:
the result

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.