com.jniwrapper.win32
Class MessageLoopThread

java.lang.Object
  extended by com.jniwrapper.win32.MessageLoopThread

public class MessageLoopThread
extends java.lang.Object


Field Summary
protected static com.jniwrapper.util.Logger _log
           
 
Constructor Summary
MessageLoopThread()
          Creates message loop instance.
MessageLoopThread(boolean daemon)
          Creates a message loop instance.
MessageLoopThread(java.lang.String name)
          Creates message loop instance.
MessageLoopThread(java.lang.String name, boolean daemon)
           
 
Method Summary
 void doAddMessageListener(MessageLoopListener listener)
          Adds message listener for the message loop.
 void doInvokeAndWait(java.lang.Runnable action)
          Invokes the action in the message loop and waits until action executes.
 void doInvokeLater(java.lang.Runnable action)
          Invokes the action in the message loop.
 java.lang.Object doInvokeMethod(java.lang.Object object, java.lang.String methodName)
          Invokes the method in the message loop and waits until the method executes.
 java.lang.Object doInvokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] parameters)
          Invokes the method in the message loop and waits until the method executes.
 void doRemoveMessageListener(MessageLoopListener listener)
          Removes message listener for the message loop.
 void doStart()
          Starts the message loop.
 void doStop()
          Stops the message loop.
protected static java.util.Map getMessageLoops()
           
 java.lang.String getName()
          Returns name of this thread.
 boolean isDispatchThread()
          Returns true if current thread is main message loop.
 boolean isStarted()
           
protected  void onStart()
           
protected  void onStop()
           
protected  void pingMessageLoopThread()
           
protected  void postSyncThreadMessage(int message, int wParam, int lParam)
          Deprecated. This method is incompatible with 64-bit architectures. Use postSyncThreadMessage(int message, long wParam, long lParam) instead.
protected  void postSyncThreadMessage(int message, long wParam, long lParam)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected static final com.jniwrapper.util.Logger _log
Constructor Detail

MessageLoopThread

public MessageLoopThread()
Creates message loop instance.


MessageLoopThread

public MessageLoopThread(java.lang.String name)
Creates message loop instance.

Parameters:
name - message loop name name

MessageLoopThread

public MessageLoopThread(boolean daemon)
Creates a message loop instance.

Parameters:
daemon - determines if the message loop thread is a daemon thread or not.

MessageLoopThread

public MessageLoopThread(java.lang.String name,
                         boolean daemon)
Method Detail

getMessageLoops

protected static java.util.Map getMessageLoops()

doStart

public void doStart()
Starts the message loop.


doStop

public void doStop()
Stops the message loop.


getName

public java.lang.String getName()
Returns name of this thread.

Returns:
message loop thread name

isStarted

public boolean isStarted()

isDispatchThread

public boolean isDispatchThread()
Returns true if current thread is main message loop.

Returns:
true if current thread is main message loop else returns false

doInvokeAndWait

public void doInvokeAndWait(java.lang.Runnable action)
                     throws java.lang.InterruptedException,
                            java.lang.reflect.InvocationTargetException
Invokes the action in the message loop and waits until action executes.

Parameters:
action - action to execute
Throws:
java.lang.InterruptedException
java.lang.reflect.InvocationTargetException

pingMessageLoopThread

protected void pingMessageLoopThread()

doInvokeLater

public void doInvokeLater(java.lang.Runnable action)
Invokes the action in the message loop.

Parameters:
action - action to execute

doInvokeMethod

public java.lang.Object doInvokeMethod(java.lang.Object object,
                                       java.lang.String methodName)
                                throws java.lang.InterruptedException,
                                       java.lang.reflect.InvocationTargetException
Invokes the method in the message loop and waits until the method executes.

Parameters:
object - object which method is called
methodName - name of called method
Throws:
java.lang.InterruptedException
java.lang.reflect.InvocationTargetException

doInvokeMethod

public java.lang.Object doInvokeMethod(java.lang.Object object,
                                       java.lang.String methodName,
                                       java.lang.Object[] parameters)
                                throws java.lang.InterruptedException,
                                       java.lang.reflect.InvocationTargetException
Invokes the method in the message loop and waits until the method executes.

Parameters:
object - which method is called
methodName - name of called method
parameters - method parameters
Throws:
java.lang.InterruptedException
java.lang.reflect.InvocationTargetException

doAddMessageListener

public void doAddMessageListener(MessageLoopListener listener)
Adds message listener for the message loop.

Parameters:
listener - message listener

doRemoveMessageListener

public void doRemoveMessageListener(MessageLoopListener listener)
Removes message listener for the message loop.

Parameters:
listener - message listener

postSyncThreadMessage

protected void postSyncThreadMessage(int message,
                                     int wParam,
                                     int lParam)
Deprecated. This method is incompatible with 64-bit architectures. Use postSyncThreadMessage(int message, long wParam, long lParam) instead.


postSyncThreadMessage

protected void postSyncThreadMessage(int message,
                                     long wParam,
                                     long lParam)

onStart

protected void onStart()

onStop

protected void onStop()