GWT Tk 0.2.3

asquare.gwt.debug.client
Class DebugEventListener

java.lang.Object
  extended by asquare.gwt.debug.client.DebugEventListener
Direct Known Subclasses:
DebugElementDumpInspector, DebugHierarchyInspector

public class DebugEventListener
extends Object

A UI event monitor. Event descriptions are output via Debug.println(String). Tracing is enabled/disabled by pressing the enabler key twice sequentially. You can specify which kinds of events you are interested in when you create the monitor.

Popups and dialogs will block the listener if they are shown after it is installed. Likewise, the listener will prevent with event filtering by popups if initialized after the popup is shown. This is due to the design of EventPreview.

See Also:
DEFAULT_ENABLE_KEY, DEFAULT_MASK, EventPreview

Field Summary
static char DEFAULT_ENABLE_KEY
          The default enabler key, which is 'e'
static int DEFAULT_MASK
          A mask matching all but onmousemove, onmouseover, onmouseout and onscroll
static int MASK_ALL
          A mask matching all events
 
Constructor Summary
DebugEventListener()
          Create a new instance with the default key code and event mask.
DebugEventListener(char enableKey)
          Create a new instance with the specified enable key and the default event mask.
DebugEventListener(char enableKey, int eventMask, String name)
          Create a new instance with the specified enable key and event mask.
DebugEventListener(int eventMask)
          Create a new instance with the specified event mask and the default enable key.
 
Method Summary
protected  void doDisabled()
          Override to perform a custom action whenever this listener is enabled.
protected  void doEnabled()
          Override to perform a custom action whenever this listener is disabled.
protected  void doEvent(Event event)
          Override to perform a custom action for each event.
 void enable(boolean enable)
          Enables/disables this listener.
 void eventDispatched(Event event)
          Called by EventPreviewDispatcher when an event is previewed.
 char getEnableKey()
          Get the key used to enable processing of events.
 int getEventMask()
          Get the bitmask representing the events which this listener will process.
 void install()
          Installs this listener so that it listens to dispatched events.
 void setEnabled(boolean enabled)
          Sets this listener as enabled/disabled but does not perform the doEnabled()/doDisabled() action.
 void setEnableKey(char keyCode)
          Set the key used to enable processing of events.
 void setEventMask(int mask)
          Specifies the events which the listener will process when it is enabled.
 void uninstall()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MASK_ALL

public static final int MASK_ALL
A mask matching all events

See Also:
Constant Field Values

DEFAULT_MASK

public static final int DEFAULT_MASK
A mask matching all but onmousemove, onmouseover, onmouseout and onscroll

See Also:
Constant Field Values

DEFAULT_ENABLE_KEY

public static final char DEFAULT_ENABLE_KEY
The default enabler key, which is 'e'

See Also:
Constant Field Values
Constructor Detail

DebugEventListener

public DebugEventListener()
Create a new instance with the default key code and event mask.


DebugEventListener

public DebugEventListener(char enableKey)
Create a new instance with the specified enable key and the default event mask.

Parameters:
enableKey - a key code, or -1 for the default ('e')

DebugEventListener

public DebugEventListener(int eventMask)
Create a new instance with the specified event mask and the default enable key.

Parameters:
eventMask - an event mask or -1 for the default
See Also:
Event

DebugEventListener

public DebugEventListener(char enableKey,
                          int eventMask,
                          String name)
Create a new instance with the specified enable key and event mask.

Parameters:
enableKey - a key code, or 0 for the default ('e')
eventMask - an event mask or -1 for the default
name - a name to identify this event listener instance in debug statements
See Also:
Event
Method Detail

install

public void install()
Installs this listener so that it listens to dispatched events. It will not process events or produce output until it is enabled by pressing the enable key twice or via enable(boolean).


uninstall

public void uninstall()

getEnableKey

public char getEnableKey()
Get the key used to enable processing of events.

Returns:
a unicode character code corresponding the key

setEnableKey

public void setEnableKey(char keyCode)
Set the key used to enable processing of events.

Parameters:
keyCode - a unicode character code corresponding the key

getEventMask

public int getEventMask()
Get the bitmask representing the events which this listener will process.

Returns:
the bitmask
See Also:
Event

setEventMask

public void setEventMask(int mask)
Specifies the events which the listener will process when it is enabled. Pass 0 to ignore all events.

Example:

setEventMask(Event.ONMOUSEDOWN | Event.ONCLICK)

Parameters:
mask - a bitmask of event types
See Also:
Event

enable

public void enable(boolean enable)
Enables/disables this listener. When enabled it will process events via doEvent(Event)

Parameters:
enable -

setEnabled

public void setEnabled(boolean enabled)
Sets this listener as enabled/disabled but does not perform the doEnabled()/doDisabled() action.

Parameters:
enabled -

eventDispatched

public void eventDispatched(Event event)
Called by EventPreviewDispatcher when an event is previewed.

Parameters:
event -

doEnabled

protected void doEnabled()
Override to perform a custom action whenever this listener is disabled.


doDisabled

protected void doDisabled()
Override to perform a custom action whenever this listener is enabled.


doEvent

protected void doEvent(Event event)
Override to perform a custom action for each event.

Parameters:
event -

GWT Tk 0.2.3

© 2007 Mat Gessel