[英]How to set GWT Class field from JSNI on Javascript event
I have this GWT Class that wrapped the Shephered Tour Javascript library: 我有一个包装了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();
}-*/;
}
What I need to accomplish is to set the finished
static field, when the 'Finish' button is clicked. 我需要完成的是单击“完成”按钮时设置
finished
静态字段。 How can I achieve that? 我该如何实现?
单击“完成”按钮时,从JavaScript(JSNI)调用Java方法,该方法设置完成的静态字段
[instance-expr.]@class-name::field-name//Syntax
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.