Package ej.microui
Class MicroUI
- java.lang.Object
-
- ej.microui.MicroUI
-
public abstract class MicroUI extends Object
TheMicroUIclass offers basic services in the MicroUI implementation.
MicroUI is started explicitly by callingstart(). MicroUI may also be stopped withstop().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 theThread.getDefaultUncaughtExceptionHandler()when no specific handler is configured. If no handler is configured, a call toThrowable.printStackTrace()is performed.
-
-
Constructor Summary
Constructors Constructor Description MicroUI()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcallSerially(Runnable run)Serializes a call event in the system event stream.static booleanisStarted()Checks if MicroUI has been started.static booleanisUIThread()Gets whether the current thread is the MicroUI thread.static booleanisUIThread(Thread thread)Gets whether the given thread is the MicroUI thread.static voidstart()Starts MicroUI.
It implies starting event serialization as well as rendering mechanisms.
This method does nothing if MicroUI is already started.static voidstop()Stops MicroUI.
It implies stopping any potential event serialization as well as rendering mechanisms.
This method does nothing if MicroUI is already stopped.
-
-
-
Method Detail
-
start
public static void start()
Starts MicroUI.
It implies starting event serialization as well as rendering mechanisms.
This method does nothing if MicroUI is already started.- Throws:
SecurityException- if a security manager exists and does not allow the caller to start MicroUI.
-
stop
public 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.- Throws:
SecurityException- if a security manager exists and does not allow the caller to stop MicroUI.
-
isStarted
public static boolean isStarted()
Checks if MicroUI has been started.- Returns:
- true when MicroUI is running.
-
isUIThread
public static boolean isUIThread(Thread thread)
Gets whether the given thread is the MicroUI thread.- Parameters:
thread- the thread to check- Returns:
trueif the given thread is the MicroUI thread,falseotherwise.- Throws:
MicroUIException- if MicroUI is not started
-
isUIThread
public static boolean isUIThread()
Gets whether the current thread is the MicroUI thread.- Returns:
trueif the current thread is the MicroUi thread,falseotherwise.- Throws:
MicroUIException- if MicroUI is not started
-
callSerially
public static void callSerially(Runnable run)
Serializes a call event in the system event stream. When the event is processed, therun()method of theRunnableobject is called.
Multiple call events may be requested withcallSerially(): they will occur in the order in which they were requested (first in first out policy).
The call to therun()method of theRunnableobject is performed asynchronously ThereforecallSerially()will never block waiting for therun()method to finish.
Therun()method should return quickly, as with other callback methods.
ThecallSerially()mechanism may be used by applications as a synchronization tool in the event stream.- Parameters:
run- aRunnableobject to call- Throws:
MicroUIException- if MicroUI is not started
-
-