繁体   English   中英

如何在Javascript事件中从JSNI设置GWT类字段

[英]How to set GWT Class field from JSNI on Javascript event

我有一个包装了Shephered Tour Javascript库的GWT类:

public class SheperedTour {
    private static boolean started = false;
    private static boolean finished = false;
    private static JavaScriptObject tour;

    public static void startTour(){
        if(!started){
            _startTour();
            started = true;
        }
    }       
    public static native void cancelTour()/*-{
        @com.mycomp.app.client.local.utils.SheperedTour::tour.cancel();
    }-*/;

    public static native void _startTour()/*-{
        tour = new $wnd.Shepherd.Tour({
            defaults: {
                classes: 'shepherd-theme-arrows'
            }
        });
        @com.mycomp.app.client.local.utils.SheperedTour::tour = tour;
        tour.addStep('tour-6', {
            text: 'When done, click this to submit',
            attachTo: '#submit left',
            buttons: [
                {
                    text: 'Finish',
                    action: tour.next
                }
            ]
        });
        tour.start();
    }-*/;
}

我需要完成的是单击“完成”按钮时设置finished静态字段。 我该如何实现?

单击“完成”按钮时,从JavaScript(JSNI)调用Java方法,该方法设置完成的静态字段

[instance-expr.]@class-name::field-name//Syntax

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM