|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.EventQueue net.wotonomy.foundation.NSRunLoop
public class NSRunLoop
NSRunLoop is provided specifically for EODelayedObserverQueue
and EOEditingContext, which assume the existence of a
prioritized event queue that Java does not provide.
This extends java.awt.EventQueue and does not conform to the
NSRunLoop specifications. The only supported methods are
NSRunLoop.currentRunLoop, performSelectorWithOrder, and
cancelSelectorWithOrder. Note that in Swing there is only
one AWT thread and one event queue; newly created threads
will not get their own run loop as in OpenStep.
That said, this event queue is servicable as a replacement
for the default event queue and will provide prioritized
execution of selectors before and after normal AWT events.
Each run loop dispatches the lowest order event from
the queue. When queued events have the same ordering,
they are dispatched as first-in, first-out (FIFO). Because
all AWT events have the same ordering (AWTEventsRunLoopOrdering),
they are processed FIFO, just like the default event queue.
Note that because EventQueue is not well-factored for
subclassing, pushing a new event queue onto the stack
on top of this one will only copy the existing AWT events
to the new queue. For this reason, pushing new event
queues onto the stack is not supported and will throw
an exception.
Field Summary | |
---|---|
static int |
AWTEventsRunLoopOrdering
This is the ordering at which the conventional AWT event queue will be executed. |
protected static NSRunLoop |
instance
The singleton instance. |
Constructor Summary | |
---|---|
protected |
NSRunLoop()
Create a new instance of NSRunLoop. |
Method Summary | |
---|---|
void |
cancelPerformSelectorWithOrder(NSSelector aSelector,
java.lang.Object aTarget,
java.lang.Object aParameter)
Cancels the next scheduled invocation of the specified selector, target, and parameter. |
static NSRunLoop |
currentRunLoop()
Returns the singleton instance of NSRunLoop. |
void |
dispatchAllEvents()
Useful method, but not in the spec. |
boolean |
dispatchNextEvent()
Useful method, but not in the spec. |
java.awt.AWTEvent |
getNextEvent()
Remove an event from the EventQueue and return it. |
static void |
invokeLaterWithOrder(java.lang.Runnable aRunnable,
int anOrdering)
Causes runnable to have its run() method on the next event loop with the specified priority ordering. |
void |
performSelectorWithOrder(NSSelector aSelector,
java.lang.Object aTarget,
java.lang.Object aParameter,
int anOrdering,
java.util.List aModeList)
Schedules the specified selector with the specified target and parameter to be invoked on the next event loop with the specified ordering. |
protected void |
pop()
This implementation calls super and then throws an UnsupportedOperationException. |
void |
postEvent(java.awt.AWTEvent theEvent)
Post a 1.1-style event to the EventQueue. |
void |
push(java.awt.EventQueue newEventQueue)
This implementation calls super and then throws an UnsupportedOperationException. |
Methods inherited from class java.awt.EventQueue |
---|
dispatchEvent, getCurrentEvent, getMostRecentEventTime, invokeAndWait, invokeLater, isDispatchThread, peekEvent, peekEvent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int AWTEventsRunLoopOrdering
protected static NSRunLoop instance
Constructor Detail |
---|
protected NSRunLoop()
Method Detail |
---|
public static NSRunLoop currentRunLoop()
public void postEvent(java.awt.AWTEvent theEvent)
postEvent
in class java.awt.EventQueue
theEvent
- an instance of java.awt.AWTEvent, or a
subclass of it.public boolean dispatchNextEvent()
public void dispatchAllEvents()
public java.awt.AWTEvent getNextEvent() throws java.lang.InterruptedException
getNextEvent
in class java.awt.EventQueue
java.lang.InterruptedException
- if another thread has interrupted this thread.public void push(java.awt.EventQueue newEventQueue)
push
in class java.awt.EventQueue
protected void pop() throws java.util.EmptyStackException
pop
in class java.awt.EventQueue
java.util.EmptyStackException
public void performSelectorWithOrder(NSSelector aSelector, java.lang.Object aTarget, java.lang.Object aParameter, int anOrdering, java.util.List aModeList)
public void cancelPerformSelectorWithOrder(NSSelector aSelector, java.lang.Object aTarget, java.lang.Object aParameter)
public static void invokeLaterWithOrder(java.lang.Runnable aRunnable, int anOrdering)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |