注意gwt应用程序中的每一次点击 [英] Notice every click in a gwt application
问题描述
我正在开发一个自动注销课程。在x分钟没有行动后,我想注销用户。
一切正常,但我需要在我的应用程序中重置计时器的位置。
我想在应用程序中每点击一次就重置计时器。有没有办法注意到每一次点击扔一个事件?也许是LayeredPanel或GlassPanel?
我不喜欢通过移动鼠标来重置定时器的想法。
Event.addNativePreviewHandler(new)解决方案
NativePreviewHandler(){
@Override
public void onPreviewNativeEvent(NativePreviewEvent event){
if(event.getNativeEvent()。getType()。equals(click)){
//重置你的计时器
}
}
});
如果用户点击了您的应用,您将有机会做一些事情。 p>
I'm working on a automatic logout class. After x minutes without actions I want to log out the user. Everything is working, but I need a point in my application where to reset my timer.
I want to reset the timer with every click in my application. Is there a way to notice every click an throw an event? Maybe a LayeredPanel or GlassPanel?
I don't like the idea of resetting the timer by moving the mouse.
You can add some code to your EntryPoint:
Event.addNativePreviewHandler(new NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getNativeEvent().getType().equals("click")) {
// reset your timer
}
}
});
In case the user clicks in your app, you'll get the chance to do something.
这篇关于注意gwt应用程序中的每一次点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!