>
> I should point out the differences.  In the first non-working example I 
> use 'this' in my export.  In the second example I remove the 'this' and 
> declare my log() method as static.
>

You already answered your own question more or less. Your export method is 
static while your log method is not. That means you can not access your log 
method using "this" inside a static JSNI method.

So you either make export() non static and keep "this", or you keep 
export() static and provide an instance as parameter if you want to keep 
log() an instance method or you make all methods static and remove "this".


All instance methods:


public class Main implements EntryPoint {
 public void onModuleLoad() {
   this.export();
 }

 public void log(String msg) {
  ...
 }
 
 public native void export() /*-{
   $wnd.log = $entry(th...@package.main::log(Ljava/lang/String));

 }-*/;


Static export() but instance log() method:


public class Main implements EntryPoint {
 public void onModuleLoad() {
   Main.export(this);
 }

 public void log(String msg) {
  ...
 }
 
 public static native void export(Main main) /*-{
   $wnd.log = $entry(ma...@package.main::log(Ljava/lang/String));

 }-*/;


All static methods:



public class Main implements EntryPoint {
 public void onModuleLoad() {
   Main.export();
 }

 public static void log(String msg) {
  ...
 }
 
 public static native void export() /*-{
   $wnd.log = $entry(@package.Main::log(Ljava/lang/String));

 }-*/;

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to