Directory

← Back

Idle

Simple user inactivity monitor for Vaadin applications ⏱️

Author

Rating

Popularity

100+

This is an extension for Vaadin to track user activity / user inactivity. Inactivity is checked by tracking mouse and keyboard moves in the whole window. After user is idle for a given period a CSS class is applied to <body> element and optionally an event is sent to the rest of the application.

This extension can be used to hide unnecessary controls when user is not active, or give a notification and/or prevent user session from expiring. ⏱️

The following CSS class names are used:

  • body.userinactive
  • body.useractive

These can be used to chance the look and feel: animate, show or hide, gray-out or just disable some elements with CSS. This works best with 'Valo' theme.

If a listener is also given, it will be notified on activity changes. This can be used to trigger some UI changes or start/stop background tasks.

Idle timeout can be configured in milliseconds. Default is 5000 (i.e. 5 seconds).

Sample code

// Apply CSS after 15sec
Idle.track(myUI, 15000);
body.userinactive .status {
    color: red;
}

body.useractive .status {
    color: green;
}
// Apply CSS and call listener after 15sec
Idle idle = Idle.track(this, 15000);
idle.addUserActiveListener(e -> status.setText("Server-side state: User active"));
idle.addUserInactiveListener(e -> status.setText("Server-side state: User inactive"));

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

Vaadin 24 release

Released
2024-01-28
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 24+
Vaadin 7.0+ in 1.0.1
Vaadin 7.4+ in 1.1.0
Vaadin 8.0+ in 2.0.0
Browser
Browser Independent

Idle - Vaadin Add-on Directory

Simple user inactivity monitor for Vaadin applications ⏱️ Idle - Vaadin Add-on Directory
This is an extension for Vaadin to track user activity / user inactivity. Inactivity is checked by tracking mouse and keyboard moves in the whole window. After user is idle for a given period a CSS class is applied to <body> element and optionally an event is sent to the rest of the application. This extension can be used to hide unnecessary controls when user is not active, or give a notification and/or prevent user session from expiring. ⏱️ The following CSS class names are used: - body.userinactive - body.useractive These can be used to chance the look and feel: animate, show or hide, gray-out or just disable some elements with CSS. This works best with 'Valo' theme. If a listener is also given, it will be notified on activity changes. This can be used to trigger some UI changes or start/stop background tasks. Idle timeout can be configured in milliseconds. Default is 5000 (i.e. 5 seconds).
Online