chrriis.dj.nativeswing.swtimpl
Class ControlCommandMessage

java.lang.Object
  extended by chrriis.dj.nativeswing.swtimpl.Message
      extended by chrriis.dj.nativeswing.swtimpl.CommandMessage
          extended by chrriis.dj.nativeswing.swtimpl.ControlCommandMessage
All Implemented Interfaces:
Serializable

public abstract class ControlCommandMessage
extends CommandMessage

A message that makes the link between a native component on the local side and its native peer control.

Author:
Christopher Deckers
See Also:
Serialized Form

Constructor Summary
ControlCommandMessage()
          Construct a control command message.
 
Method Summary
 void asyncExec(boolean isTargetNativeSide, Object... args)
          Execute that message asynchronously with the given arguments.
 void asyncExec(Control control, Object... args)
          Execute that message asynchronously with the given arguments.
 void asyncExec(NativeComponent nativeComponent, Object... args)
          Execute that message asynchronously with the given arguments.
 Control getControl()
          Get the control, which is only valid when in the native context.
 NativeComponent getNativeComponent()
          Get the native component, which is only valid when in the local context.
protected  boolean isValid()
          Indicate whether the message is valid.
 void setControl(Control control)
          Set the control that is used to identify the control on the local side.
 void setNativeComponent(NativeComponent nativeComponent)
          Set the native component that is used to identify the control on the native side.
 Object syncExec(boolean isTargetNativeSide, Object... args)
          Execute that message synchronously with the given arguments and return the result.
 Object syncExec(Control control, Object... args)
          Execute that message synchronously with the given arguments and return the result.
 Object syncExec(NativeComponent nativeComponent, Object... args)
          Execute that message synchronously with the given arguments and return the result.
 
Methods inherited from class chrriis.dj.nativeswing.swtimpl.CommandMessage
run, toString
 
Methods inherited from class chrriis.dj.nativeswing.swtimpl.Message
asyncSend, syncSend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ControlCommandMessage

public ControlCommandMessage()
Construct a control command message.

Method Detail

setControl

public void setControl(Control control)
Set the control that is used to identify the control on the local side.

Parameters:
control - the control.

setNativeComponent

public void setNativeComponent(NativeComponent nativeComponent)
Set the native component that is used to identify the control on the native side.

Parameters:
nativeComponent - the native component.

getControl

public Control getControl()
Get the control, which is only valid when in the native context.

Returns:
the control, or null.

getNativeComponent

public NativeComponent getNativeComponent()
Get the native component, which is only valid when in the local context.

Returns:
the native component, or null.

asyncExec

public void asyncExec(NativeComponent nativeComponent,
                      Object... args)
Execute that message asynchronously with the given arguments.

Parameters:
nativeComponent - the native component.
args - the arguments, which must be serializable.

asyncExec

public void asyncExec(Control control,
                      Object... args)
Execute that message asynchronously with the given arguments.

Parameters:
control - the native component.
args - the arguments, which must be serializable.

syncExec

public Object syncExec(NativeComponent nativeComponent,
                       Object... args)
Execute that message synchronously with the given arguments and return the result.

Parameters:
nativeComponent - the native component.
args - the arguments, which must be serializable.
Returns:
the result of the execution.

syncExec

public Object syncExec(Control control,
                       Object... args)
Execute that message synchronously with the given arguments and return the result.

Parameters:
control - the control.
args - the arguments, which must be serializable.
Returns:
the result of the execution.

syncExec

public Object syncExec(boolean isTargetNativeSide,
                       Object... args)
Description copied from class: CommandMessage
Execute that message synchronously with the given arguments and return the result.

Overrides:
syncExec in class CommandMessage
Parameters:
isTargetNativeSide - true if the target is the native side, false otherwise.
args - the arguments, which must be serializable.
Returns:
the result of the execution.

asyncExec

public void asyncExec(boolean isTargetNativeSide,
                      Object... args)
Description copied from class: CommandMessage
Execute that message asynchronously with the given arguments.

Overrides:
asyncExec in class CommandMessage
Parameters:
isTargetNativeSide - true if the target is the native side, false otherwise.
args - the arguments, which must be serializable.

isValid

protected boolean isValid()
Description copied from class: Message
Indicate whether the message is valid. This is called before interpreting it to give a chance for the message to prevent its interpretation.

Overrides:
isValid in class Message
Returns:
true if the message is valid and should be interpreted, false otherwise.