Directory

← Back

UserInactivity Add-on

An extension to track user activity, and inactivity timeout.

Author

Rating

Popularity

<100

Because saying "Take note of any unsaved data" after session expired really sucks :)

This add-on provides timeout, and action events. To build something useful you have to implement listeners, and for example pop-up a warning, or a countdown window. You might find countdownclock extension useful too.

What the extension counts as a user activity (or action)?

  • It's a user interaction followed by an uidl request.

Implementation details.

Both timeout and activity tracking is implemented on client side. Timeout is handled with a GWT timer. User action tracked by MOUSEDOWN, KEYDOWN, TOUCHSTART events, and an rpc method called to signal the event to server side. The rpc call is delayed, so it's fired when vaadin sends an uidl request.

Timeout modes

You can register your timeout listene for an UI, or for a Session. It depends on your needs, wich one to use.

For a near-usable example clone from github, and play with the demo module.

Sample code

@Override
protected void init(VaadinRequest request) {
    UserInactivityExtension userInactivityExtension = UserInactivityExtension.init(this);
    userInactivityExtension.addTimeoutListener(new UserInactivityExtension.TimeoutListener() {
        Notification.show("Inactivity report sent to your boss");
    });
    userInactivityExtension.scheduleTimeout(120);
    ...
@Override
protected void init(VaadinRequest request) {
    UserInactivityExtension userInactivityExtension = UserInactivityExtension.init(this);
    SessionTimeoutHandler sessionTimeoutHandler = userInactivityExtension.initSessionTimeoutHandler();
    sessionTimeoutHandler.addTimeoutListener(new SessionTimeoutHandler.SessionTimeoutListener() {

        @Override
        public void timeout() {
            Notification.show("Inactivity report sent to your boss");
        }
    });
    sessionTimeoutHandler.start(120);    
    ...

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Released
2014-11-25
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.3+
Browser
Browser Independent

UserInactivity Add-on - Vaadin Add-on Directory

An extension to track user activity, and inactivity timeout. UserInactivity Add-on - Vaadin Add-on Directory
Because saying "Take note of any unsaved data" after session expired really sucks :) This add-on provides timeout, and action events. To build something useful you have to implement listeners, and for example pop-up a warning, or a countdown window. You might find countdownclock extension useful too. What the extension counts as a user activity (or action)? - It's a user interaction followed by an uidl request. Implementation details. Both timeout and activity tracking is implemented on client side. Timeout is handled with a GWT timer. User action tracked by MOUSEDOWN, KEYDOWN, TOUCHSTART events, and an rpc method called to signal the event to server side. The rpc call is delayed, so it's fired when vaadin sends an uidl request. Timeout modes You can register your timeout listene for an UI, or for a Session. It depends on your needs, wich one to use. For a near-usable example clone from github, and play with the demo module.
Online