APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.glass.ui

public final Class EventLoop

extends Object
Class Inheritance
Imports
java.util.ArrayDeque, .Deque

An object representing a nested event loop.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
EventLoop.State

Possible states for a nested event loop object.

Field Summary

Modifier and TypeField and Description
private Object
private static final Deque<EventLoop>
private EventLoop.State

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

an object passed to the leave() method
enter
()

Starts a nested event loop.

public EventLoop.State
getState()

Gets the current State of this EventLoop instance.

public void
leave(Object ret)

Requests this nested event loop to terminate.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

returnValueback to summary
private Object returnValue
stackback to summary
private static final Deque<EventLoop> stack
stateback to summary
private EventLoop.State state

Constructor Detail

EventLoopback to summary
pack-priv EventLoop()

Method Detail

enterback to summary
public Object enter()

Starts a nested event loop. The EventLoop object must be in the IDLE state when calling this method. Upon entering the nested event loop, the state of the object changes to ACTIVE. When the method returns, the EventLoop object is back to the IDLE state. Calling this method temporarily blocks processing of the current event, and starts a nested event loop to handle other native events. To proceed with the blocked execution path, the application should call the leave(Object) method. Note that this method must only be invoked on the main (event handling) thread. An application may enter several nested loops recursively. Each nested event loop must be represented by a separate EventLoop instance. There's no limit of recursion other than that imposed by the native stack size.

Returns:Object

an object passed to the leave() method

Exceptions
RuntimeException:
if the current thread is not the main thread
IllegalStateException:
if the EventLoop object isn't IDLE
getStateback to summary
public EventLoop.State getState()

Gets the current State of this EventLoop instance. This method must only be invoked on the main (event handling) thread.

leaveback to summary
public void leave(Object ret)

Requests this nested event loop to terminate. The EventLoop object must be in the ACTIVE state when calling this method. This method switches the state of the object to LEAVING. After calling this method and returning from the current event handler, the execusion returns to the point where the enter() method was called previously. You may specify a return value for the enter() method by passing the argument retValue to the leave(). Calls to enter() and leave() may be interleaved for different event loops. If the EventLoop object is not innermost (i.e. not most recently started), calling leave() just switches this EventLoop object to the LEAVING state w/o actually terminating it after returning from the current event handler. The enter() method that started this event loop only returns after all inner event loops are terminated. Note that this method must only be invoked on the main (event handling) thread.

Exceptions
RuntimeException:
if the current thread is not the main thread
IllegalStateException:
if the nested event loop isn't ACTIVE
com.sun.glass.ui back to summary

public final Enum EventLoop.State

extends Enum<EventLoop.State>
Class Inheritance

Possible states for a nested event loop object.

Field Summary

Modifier and TypeField and Description
public static final EventLoop.State
ACTIVE

The nested loop represented by this object is currently running.

public static final EventLoop.State
IDLE

A free EventLoop object that can be used to start a new nested event loop.

public static final EventLoop.State
LEAVING

The nested loop has been requested to leave.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static EventLoop.State
public static EventLoop.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ACTIVEback to summary
public static final EventLoop.State ACTIVE

The nested loop represented by this object is currently running.

IDLEback to summary
public static final EventLoop.State IDLE

A free EventLoop object that can be used to start a new nested event loop.

LEAVINGback to summary
public static final EventLoop.State LEAVING

The nested loop has been requested to leave.

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static EventLoop.State valueOf(String name)
valuesback to summary
public static EventLoop.State[] values()