net.sf.j2s.ajax
Class ASWTClass

java.lang.Object
  extended bynet.sf.j2s.ajax.AClass
      extended bynet.sf.j2s.ajax.ASWTClass

public class ASWTClass
extends AClass

This class is designed to load class asynchronously within the same thread of given Shell or Display. Because executing callback after given class is loaded will be in another thread scope of current Display. In order to avoid nasty codes of such

        Display.getDefault().asyncExec(new Runnable() {
                        public void run() {
                                //...
                        }
        });
 
This class ASWTClass is designed so developer won't need to code in such nasty way. Just call ASWTClass#swtLoad with the same parameter as AClass#load. Or call ASWTClass#shellLoad or ASWTClass#displayLoad with extra Shell/Display argument.

Author:
josson smith 2006-8-4

Method Summary
static void displayLoad(org.eclipse.swt.widgets.Display display, java.lang.String clazzName, java.lang.Runnable afterLoaded)
          Load class asynchronously and execute callback in the same thread of given Display's thread.
static void shellLoad(org.eclipse.swt.widgets.Shell shell, java.lang.String clazzName, java.lang.Runnable afterLoaded)
          Load class asynchronously and execute callback in the same thread of given Shell's Display.
static void swtLoad(java.lang.String clazzName, java.lang.Runnable afterLoaded)
          Load class by given class name and execute callback in the same thread of default Display's thread.
 
Methods inherited from class net.sf.j2s.ajax.AClass
load
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

swtLoad

public static void swtLoad(java.lang.String clazzName,
                           java.lang.Runnable afterLoaded)
Load class by given class name and execute callback in the same thread of default Display's thread.

Parameters:
clazzName - String given class name.
afterLoaded - Runnable given callback. If this parameter is an instance of ARunnable, the callback will receive the loaded class automatically.

displayLoad

public static void displayLoad(org.eclipse.swt.widgets.Display display,
                               java.lang.String clazzName,
                               java.lang.Runnable afterLoaded)
Load class asynchronously and execute callback in the same thread of given Display's thread.

Parameters:
display - Display given display
clazzName - String given class name.
afterLoaded - Runnable given callback. If this parameter is an instance of ARunnable, the callback will receive the loaded class automatically.

shellLoad

public static void shellLoad(org.eclipse.swt.widgets.Shell shell,
                             java.lang.String clazzName,
                             java.lang.Runnable afterLoaded)
Load class asynchronously and execute callback in the same thread of given Shell's Display.

Parameters:
shell - Shell given shell
clazzName - String given class name.
afterLoaded - Runnable given callback. If this parameter is an instance of ARunnable, the callback will receive the loaded class automatically.