com.tensegrity.gui.swt.graph
Class ObserverRunnable

java.lang.Object
  extended bycom.tensegrity.gui.swt.graph.ObserverRunnable
All Implemented Interfaces:
java.lang.Runnable

public abstract class ObserverRunnable
extends java.lang.Object
implements java.lang.Runnable

This class can be used in an SWT context to implement the Observer.update(Observable, Object) method on custom Observer. The SWT thread model will not allow modifying SWT objects outside of the UI-Thread, so custom observers need to execute their update code into this UI-Thread. This can be done by mean of the Display.syncExec(java.lang.Runnable) or Display.asyncExec(java.lang.Runnable) methods. For a typical example on how one should use this class, see the implementation of SwtGraphPanel.update(Observable, Object). It does the following; public void update(Observable o, Object arg) { Runnable thread = new ObserverRunnable(o, arg) { public void run() { viewScrollingController.updateSliders(); //more code follow .. } }; getDisplay().syncExec(thread); } For more information, one can refer two the following FAQ entry: uithread

Version:
$Id: ObserverRunnable.java,v 1.1 2004/03/26 15:46:13 SebastienGuyon Exp $
Author:
S�bastien Guyon

Constructor Summary
protected ObserverRunnable(Observable o, java.lang.Object arg)
           Initializes instances of ObserverRunnable with the passed Observable information.
 
Method Summary
protected  java.lang.Object getArg()
          Provides access to the Observable additional arguments.
protected  Observable getObservable()
          Provides access to the Observable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Constructor Detail

ObserverRunnable

protected ObserverRunnable(Observable o,
                           java.lang.Object arg)

Initializes instances of ObserverRunnable with the passed Observable information.

Parameters:
o - an Observable
arg - additional arguments from the Observable
Method Detail

getArg

protected java.lang.Object getArg()
Provides access to the Observable additional arguments.

Returns:
Returns the Observable additional arguments.

getObservable

protected Observable getObservable()
Provides access to the Observable.

Returns:
Returns the Observable.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.