我有一个GWT类,它封装了Shephered Tour Javascript库:
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