public abstract class MicroUI extends Object
MicroUI
class offers basic services in the MicroUI implementation.start()
. MicroUI may also be stopped with stop()
.
MicroUI is using a dedicated thread to read the input events and to manage the display serialized event mechanism.
This thread is started when method start()
is called.
This internal thread can call application methods (such as event callback). All exceptions thrown during this peace
of code are caught and redirected to the thread uncaught exception handler
(Thread.getUncaughtExceptionHandler()
) or to the Thread.getDefaultUncaughtExceptionHandler()
when no
specific handler is configured. If no handler is configured, a call to Throwable.printStackTrace()
is
performed.
Modifier and Type | Method and Description |
---|---|
static void |
callSerially(Runnable run)
Serializes a call event in the system event stream.
|
static boolean |
isStarted()
Checks if MicroUI has been started.
|
static boolean |
isUIThread()
Gets whether the current thread is the MicroUI thread.
|
static boolean |
isUIThread(Thread thread)
Gets whether the given thread is the MicroUI thread.
|
static void |
start()
Starts MicroUI.
It implies starting event serialization as well as rendering mechanisms. This method does nothing if MicroUI is already started. |
static void |
stop()
Stops MicroUI.
It implies stopping any potential event serialization as well as rendering mechanisms. This method does nothing if MicroUI is already stopped. |
public static void callSerially(Runnable run)
run()
method of
the Runnable
object is called.callSerially()
: they will occur in the order in which
they were requested (first in first out policy).run()
method of the Runnable
object is performed asynchronously
Therefore callSerially()
will never block waiting for the run()
method to finish.run()
method should return quickly, as with other callback methods.callSerially()
mechanism may be used by applications as a synchronization tool in the event
stream.run
- a Runnable
object to callMicroUIException
- if MicroUI is not startedpublic static boolean isStarted()
public static boolean isUIThread()
true
if the current thread is the MicroUi thread, false
otherwise.MicroUIException
- if MicroUI is not startedpublic static boolean isUIThread(Thread thread)
thread
- the thread to checktrue
if the given thread is the MicroUI thread, false
otherwise.MicroUIException
- if MicroUI is not startedpublic static void start()
SecurityException
- if a security manager exists and does not allow the caller to start MicroUI.public static void stop()
SecurityException
- if a security manager exists and does not allow the caller to stop MicroUI.