danger.app
Class Listener

java.lang.Object
  |
  +--danger.app.Listener
Direct Known Subclasses:
Application, NotificationManager, PhotoGallery, PreviewTone, SettingsDB, ToneGallery, ToneManager, View

public class Listener
extends java.lang.Object


Constructor Summary
Listener()
           
Listener(Dispatcher d)
           
 
Method Summary
 void cancelEvents(int type, int what)
           
 boolean receiveEvent(Event e)
          Entry point for event processing.
protected  boolean receiveEventInternal(Event e)
          Internal entry point for event processing.
 void sendEvent(Event e)
          Send an event by object.
 void sendEvent(int type, int what, int data, java.lang.Object arg)
          Send an event by parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Listener

public Listener()

Listener

public Listener(Dispatcher d)
Method Detail

receiveEvent

public boolean receiveEvent(Event e)
Entry point for event processing. Default behaviour is to do nothing and return false. Normally this method is called from a Dispatcher when it discovers an Event in its queue that is targetted at this Listener.

receiveEventInternal

protected boolean receiveEventInternal(Event e)
Internal entry point for event processing. Default behaviour is to do nothing and return false. receiveEventInternal() is called before ReceiveEvent() by the dispatcher. If receiveEventInternal() consumes the event, it is dispatched and done with. Otherwise, ReceiveEvent() gets a crack at it. This dispatch order allows listeners to handle essential events without the danger of them being trampled in the ReceiveEvent() of subclasses. In order to accomplish this, you need to declare your receiveEventInternal() implementation as final.
Parameters:
e - An Event containing the event to be sent.

sendEvent

public final void sendEvent(Event e)
Send an event by object. Queue an event for eventual receipt. This method will return immediately upon queuing; that is, it won't wait for the event to be processed.
Parameters:
e - An Event containing the event to be sent.

sendEvent

public final void sendEvent(int type,
                            int what,
                            int data,
                            java.lang.Object arg)
Send an event by parameters. Send an event without having to create an event object. The individual event elements are specified by the parameters. The method will then create an Event object an call the object-based version of this method.
Parameters:
type - An int containing the type of event to be sent.
what - An int containing a sub-type for the event.
data - An int containing additional data for the event.
arg - An Object containing an object related to the event.
See Also:
EventType

cancelEvents

public final void cancelEvents(int type,
                               int what)


Danger Confidential. Copyright © 2000-2003, Danger Inc.