This extension has almost no server-side functionality; the whole Extension class is as follows:
Java
When there’s nothing to configure for the extension, users just want to enable it for some component and be done with it. By defining a static factory method, the user only needs to do something like CapsLockWarning.warnFor(myPasswordField);
to make get the new functionality.
We add a key press handler to the password widget, checking if the input looks like Caps Lock might be enabled. The Caps Lock state cannot be directly queried in GWT/JavaScript, so we use a trick: check if either
Java
To use the Caps Lock warning, compile your widgetset and extend a PasswordField with something like this
Java