|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.app.Listener
public class Listener
Base class for things that can receive events.
| Constructor Summary | |
|---|---|
Listener()
Construct an instance. |
|
Listener(Dispatcher d)
Construct an instance. |
|
| Method Summary | |
|---|---|
void |
cancelEvents(int type,
int what)
Cancel all events of the given type and subtype that this instance's Dispatcher has queued. |
boolean |
childEventPump()
Invokes childRun() on this Listener's Dispatcher. |
boolean |
childEventPumpDone()
Invokes childRunDone() on this Listener's Dispatcher. |
boolean |
eventProblem(Event event,
Throwable ex)
Handle an exception caused by event processing. |
boolean |
isDispatchingThread()
Invokes isDispatchingThread() on this Listener's
Dispatcher. |
boolean |
receiveEvent(Event event)
Entry point for event processing. |
protected boolean |
receiveEventInternal(Event e)
Internal entry point for event processing. |
void |
sendEvent(Event e)
Send the given Event object. |
void |
sendEvent(int type)
Construct and send an event. |
void |
sendEvent(int type,
int what)
Construct and send an event. |
void |
sendEvent(int type,
int what,
int data)
Construct and send an event. |
void |
sendEvent(int type,
int what,
int data,
Object arg)
Construct and send an event. |
void |
sendLowPriorityEvent(Event e)
Send the given Event object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Listener()
null (and a
warning to that effect will be issued to the log).
public Listener(Dispatcher d)
null then the dispatcher will be set to
the current application's dispatcher; in this case, if the calling
thread is not part of an application, then the dispatcher will be
null (and a warning to that effect will be issued to
the log).
d - null-ok; the dispatcher for the listener, or null
to use the current application's dispatcher| Method Detail |
|---|
public boolean receiveEvent(Event event)
Dispatcher when it reads an Event in its queue
that is targetted at this instance. This base class implementation
handles event methods as specified by the eventMethod
keyword in .rsrc files. If you override this method, be sure to
call super.receiveEvent.
event - non-null; the event to process
true) or not (false) this
method actually handled the event to completion
public boolean eventProblem(Event event,
Throwable ex)
Dispatcher's run loop when it
catches any exception (in the generic sense, that is any Throwable). The method should handle the exception in an
appropriate way and then indicate (by the return value) whether or
not the dispatcher should continue to run.
By default, this just calls the same-named method on
this instance's Dispatcher.
event - non-null; the event whose processing caused the exceptionex - non-null; the exception that was thrown
true) or not (false) to
continue running the dispatcher looppublic final void sendEvent(Event e)
Event object. This queues the given event for
eventual receipt. This method will return immediately upon queuing;
that is, it won't wait for the event to be processed.
e - non-null; the event to queue uppublic final void sendLowPriorityEvent(Event e)
Event object. This queues the given event for
eventual receipt after all events sent to the same dispatcher with
sendEvent() and all expired timers have completed. This method will
return immediately upon queuing; that is, it won't wait for the event
to be processed.
e - non-null; the event to queue up
public final void sendEvent(int type,
int what,
int data,
Object arg)
Event using
the given arguments (recycling a used event if possible), targetting
this instance, and then queues it up by calling sendEvent(Event).
type - the type of the eventwhat - the sub-type of the eventdata - additional data for the eventarg - null-ok; an object related to the event
public final void sendEvent(int type,
int what,
int data)
Event using
the given arguments (recycling a used event if possible), targetting
this instance, and then queues it up by calling sendEvent(Event).
type - the type of the eventwhat - the sub-type of the eventdata - additional data for the event
public final void sendEvent(int type,
int what)
Event using
the given arguments (recycling a used event if possible), targetting
this instance, and then queues it up by calling sendEvent(Event).
type - the type of the eventwhat - the sub-type of the eventpublic final void sendEvent(int type)
Event using
the given arguments (recycling a used event if possible), targetting
this instance, and then queues it up by calling sendEvent(Event).
type - the type of the event
public final void cancelEvents(int type,
int what)
Dispatcher has queued.
type - the type of the event(s) in questionwhat - the sub-type of the event(s) in questionpublic final boolean childEventPump()
childRun() on this Listener's Dispatcher.
childRun()Dispatcher.childRun()public final boolean childEventPumpDone()
childRunDone() on this Listener's Dispatcher.
childRunDone()Dispatcher.childRunDone()public final boolean isDispatchingThread()
isDispatchingThread() on this Listener's
Dispatcher.
isDispatchingThread()Dispatcher.isDispatchingThread()protected boolean receiveEventInternal(Event e)
receiveEvent(danger.app.Event) by a Dispatcher. If this method
consumes the event (that is, returns true), then
nothing more is done with the event. 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.
e - non-null; the event to process
true) or not (false) this
method actually handled the event to completion
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||