java::awt::event::InvocationEvent Class Reference

Inheritance diagram for java::awt::event::InvocationEvent:

Inheritance graph
java::awt::AWTEventjava::util::EventObjectjava::lang::Objectjava::lang::Interfacejava::awt::ActiveEvent
[legend]
Collaboration diagram for java::awt::event::InvocationEvent:

Collaboration graph
java::awt::AWTEventjava::util::EventObjectjava::lang::Objectjava::lang::ObjectRefjava::lang::Interfacejava::lang::Comparablejava::awt::ActiveEvent
[legend]

List of all members.


Detailed Description

An event which executes the run() method on a Runnable when dispatched by the AWT event dispatcher thread.

This class can be used as a reference implementation of ActiveEvent rather than declaring a new class and defining dispatch().

Instances of this class are placed on the EventQueue by calls to invokeLater and invokeAndWait. Client code can use this fact to write replacement functions for invokeLater and invokeAndWait without writing special-case code in any AWTEventListener objects.

Author:
Fred Ecks

David Mendenhall

Version:
1.14, 01/23/03
See also:
java.awt.ActiveEvent

java.awt.EventQueue::invokeLater

java.awt.EventQueue::invokeAndWait

AWTEventListener

Since:
1.2

Public Types

enum  INVOCATION_EVENT_ID { INVOCATION_FIRST = 1200, INVOCATION_DEFAULT = INVOCATION_FIRST, INVOCATION_LAST = INVOCATION_DEFAULT }

Public Member Functions

 InvocationEvent (const ObjectRef &source, const Ref< Runnable > runnable, const Ref< Sync > notifier=0, jboolean catchExceptions=false)
 Constructs an InvocationEvent with the specified source which will execute the runnable's run method when dispatched.
 InvocationEvent (const ObjectRef &source=0, jint id=INVOCATION_DEFAULT, const Ref< Runnable > runnable=0, const Ref< Sync > notifier=0, jboolean catchExceptions=false)
 Constructs an InvocationEvent with the specified source and ID which will execute the runnable's run method when dispatched.
virtual void dispatch ()
 Executes the Runnable's run() method and notifies the notifier (if any) when run() returns.
virtual Ref< ExceptiongetException () const
 Returns any Exception caught while executing the Runnable's run() method.
virtual String paramString () const
 Returns a parameter string identifying this action event.
virtual String toString () const
 Returns a String representation of this object.

Protected Attributes

Ref< Runnablerunnable
 The Runnable whose run() method will be called.
Ref< Syncnotifier
 The (potentially null) Object whose notifyAll() method will be called immediately after the Runnable.run() method returns.
jboolean catchExceptions
 Set to true if dispatch() catches Exception and stores it in the exception instance variable.
Ref< Exceptionexception
 The (potentially null) Exception thrown during execution of the Runnable.run() method.

Member Enumeration Documentation

enum java::awt::event::InvocationEvent::INVOCATION_EVENT_ID

Enumerator:
INVOCATION_FIRST  Marks the first integer id for the range of invocation event ids.
INVOCATION_DEFAULT  The default id for all InvocationEvents.
INVOCATION_LAST  Marks the last integer id for the range of invocation event ids.


Constructor & Destructor Documentation

java::awt::event::InvocationEvent::InvocationEvent ( const ObjectRef source,
const Ref< Runnable runnable,
const Ref< Sync notifier = 0,
jboolean  catchExceptions = false 
)

Constructs an InvocationEvent with the specified source which will execute the runnable's run method when dispatched.

If notifier is non-null, notifyAll() will be called on it immediately after run returns.

Parameters:
source the Object that originated the event
runnable the Runnable whose run method will be executed
notifier the Object whose notifyAll method will be called after Runnable.run has returned
catchExceptions specifies whether dispatch should catch Exception when executing the Runnable's run method, or should instead propagate those Exceptions to the EventDispatchThread's dispatch loop

java::awt::event::InvocationEvent::InvocationEvent ( const ObjectRef source = 0,
jint  id = INVOCATION_DEFAULT,
const Ref< Runnable runnable = 0,
const Ref< Sync notifier = 0,
jboolean  catchExceptions = false 
)

Constructs an InvocationEvent with the specified source and ID which will execute the runnable's run method when dispatched.

If notifier is non-null, notifyAll will be called on it immediately after run returns.

Note that passing in an invalid id results in unspecified behavior.

Parameters:
source the Object that originated the event
id the ID for the event
runnable the Runnable whose run method will be executed
notifier the Object whose notifyAll method will be called after Runnable.run has returned
catchExceptions specifies whether dispatch should catch Exception when executing the Runnable's run method, or should instead propagate those Exceptions to the EventDispatchThread's dispatch loop


Member Function Documentation

virtual void java::awt::event::InvocationEvent::dispatch (  )  [virtual]

Executes the Runnable's run() method and notifies the notifier (if any) when run() returns.

Implements java::awt::ActiveEvent.

virtual Ref<Exception> java::awt::event::InvocationEvent::getException (  )  const [virtual]

Returns any Exception caught while executing the Runnable's run() method.

Returns:
A reference to the Exception if one was thrown; null if no Exception was thrown or if this InvocationEvent does not catch exceptions

virtual String java::awt::event::InvocationEvent::paramString (  )  const [virtual]

Returns a parameter string identifying this action event.

This method is useful for event-logging and for debugging.

Returns:
a string identifying the event and its associated command

Reimplemented from java::awt::AWTEvent.

virtual String java::awt::event::InvocationEvent::toString (  )  const [virtual]

Returns a String representation of this object.

Reimplemented from java::awt::AWTEvent.


Member Data Documentation

Ref<Runnable> java::awt::event::InvocationEvent::runnable [protected]

The Runnable whose run() method will be called.

Ref<Sync> java::awt::event::InvocationEvent::notifier [protected]

The (potentially null) Object whose notifyAll() method will be called immediately after the Runnable.run() method returns.

jboolean java::awt::event::InvocationEvent::catchExceptions [protected]

Set to true if dispatch() catches Exception and stores it in the exception instance variable.

If false, Exceptions are propagated up to the EventDispatchThread's dispatch loop.

Ref<Exception> java::awt::event::InvocationEvent::exception [protected]

The (potentially null) Exception thrown during execution of the Runnable.run() method.

This variable will also be null if a particular instance does not catch exceptions.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:16 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3