org.apache.tapestry.event
Class BrowserEvent

java.lang.Object
  extended by org.apache.tapestry.event.BrowserEvent

public class BrowserEvent
extends Object

Represents a client side generated browser event.


Field Summary
static String CHAR_CODE
           
static String COMPONENT_ID
           
static String COMPONENT_ID_PATH
           
static String KEYS
           
static String LAYER_X
           
static String LAYER_Y
           
static String METHOD_ARGUMENTS
           
static String NAME
           
static String PAGE_X
           
static String PAGE_Y
           
static String TARGET
           
static String TARGET_ATTR_ID
           
static String TYPE
           
 
Constructor Summary
BrowserEvent(IRequestCycle cycle)
          Creates a new browser event that will extract its own parameters.
BrowserEvent(String name, EventTarget target)
          Creates a new browser event with the specified name/target properties.
BrowserEvent(String name, String componentId, String componentIdPath, EventTarget target)
          Creates a new browser event with the specified name/target properties.
 
Method Summary
 boolean equals(Object o)
           
 String getCharCode()
           
 String getComponentId()
          Only when the event targeted a IComponent - will return the originating components id as returned from IComponent.getId().
 String getComponentIdPath()
          If the event was generated for a IComponent - will be the value returned from IComponent.getExtendedId().
 String[] getKeys()
           
 String getLayerX()
           
 String getLayerY()
           
 JSONArray getMethodArguments()
           
 String getName()
          The name of the event that was generated.
 String getPageX()
           
 String getPageY()
           
 EventTarget getTarget()
          Returns the target of the client side event.
 String getType()
           
static boolean hasBrowserEvent(IRequestCycle cycle)
          Utility method to check if the current request contains a browser event.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values

TYPE

public static final String TYPE
See Also:
Constant Field Values

KEYS

public static final String KEYS
See Also:
Constant Field Values

CHAR_CODE

public static final String CHAR_CODE
See Also:
Constant Field Values

PAGE_X

public static final String PAGE_X
See Also:
Constant Field Values

PAGE_Y

public static final String PAGE_Y
See Also:
Constant Field Values

LAYER_X

public static final String LAYER_X
See Also:
Constant Field Values

LAYER_Y

public static final String LAYER_Y
See Also:
Constant Field Values

TARGET

public static final String TARGET
See Also:
Constant Field Values

TARGET_ATTR_ID

public static final String TARGET_ATTR_ID
See Also:
Constant Field Values

COMPONENT_ID

public static final String COMPONENT_ID
See Also:
Constant Field Values

COMPONENT_ID_PATH

public static final String COMPONENT_ID_PATH
See Also:
Constant Field Values

METHOD_ARGUMENTS

public static final String METHOD_ARGUMENTS
See Also:
Constant Field Values
Constructor Detail

BrowserEvent

public BrowserEvent(IRequestCycle cycle)
Creates a new browser event that will extract its own parameters.

Parameters:
cycle - The request cycle to extract parameters from.

BrowserEvent

public BrowserEvent(String name,
                    EventTarget target)
Creates a new browser event with the specified name/target properties.

Parameters:
name - The name of the event, ie "onClick", "onBlur", etc..
target - The target of the client side event.

BrowserEvent

public BrowserEvent(String name,
                    String componentId,
                    String componentIdPath,
                    EventTarget target)
Creates a new browser event with the specified name/target properties.

Currently used for testing only.

Parameters:
name - The name of the event, ie "onClick", "onBlur", etc..
componentId - Component targeted.
componentIdPath - The id path of the component.
target - The target of the client side event.
Method Detail

getName

public String getName()
The name of the event that was generated.

Examples would be onClick,onSelect,onLoad,etc....

Returns:
The event name.

getTarget

public EventTarget getTarget()
Returns the target of the client side event.

Returns:
The target representation of the client side object event originally bound for.

getComponentId

public String getComponentId()
Only when the event targeted a IComponent - will return the originating components id as returned from IComponent.getId(). Not present on element events.

Returns:
The originating component id that generated the event.

getComponentIdPath

public String getComponentIdPath()
If the event was generated for a IComponent - will be the value returned from IComponent.getExtendedId().

Returns:
Component path id, or null if not present.

getCharCode

public String getCharCode()
Returns:
the charCode

getKeys

public String[] getKeys()
Returns:
the keys

getLayerX

public String getLayerX()
Returns:
the layerX

getLayerY

public String getLayerY()
Returns:
the layerY

getPageX

public String getPageX()
Returns:
the pageX

getPageY

public String getPageY()
Returns:
the pageY

getType

public String getType()
Returns:
the type

getMethodArguments

public JSONArray getMethodArguments()
Returns:
the method arguments of an intercepted method-call, if any. If none are available, return an empty JSONArray, never null.
Throws:
org.apache.hivemind.ApplicationRuntimeException - when the JSON-String could not be parsed.

hasBrowserEvent

public static boolean hasBrowserEvent(IRequestCycle cycle)
Utility method to check if the current request contains a browser event.

Parameters:
cycle - The associated request.
Returns:
True if the request contains browser event data.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.