public class FormValidationTriggerFocus extends Object implements FormValidationTrigger, FormFocusListener
A specialized FormValidationTrigger implementation that triggers a
validation operation whenever the user leaves an input field.
This validation trigger implementation registers itself as focus listener on all input components of the form to monitor. Whenever it receives a focus lost event, it triggers a validation operation.
This way the user gets fast feedback about invalid input. Invalid fields can
be marked while editing the form, and fresh validation error messages can be
displayed. Because validation happens only if the user switches to another
input field, the number of validations (a UI updates related to validation)
is limited. So this FormValidationTrigger is a good compromise
between real-time validation feedback and annoying the user with permanent
validation messages.
Implementation note: This class is not thread-safe. An instance should be
associated with a single FormController only and not be reused.
| Constructor and Description |
|---|
FormValidationTriggerFocus() |
| Modifier and Type | Method and Description |
|---|---|
void |
focusGained(FormFocusEvent e)
Notifies this object that an input component gained focus.
|
void |
focusLost(FormFocusEvent e)
Notifies this object that an input component lost focus.
|
FormController |
getFormController()
Returns a reference to the associated
FormController. |
void |
initTrigger(FormController controller)
Initializes this
FormValidationTrigger. |
public final FormController getFormController()
FormController.FormControllerpublic void initTrigger(FormController controller)
FormValidationTrigger. This implementation
stores the FormController reference and registers itself as
global focus listener. Thus it can intercept every change in the focus of
the associated input form.initTrigger in interface FormValidationTriggercontroller - the FormControllerpublic void focusGained(FormFocusEvent e)
focusGained in interface FormFocusListenere - the focus eventpublic void focusLost(FormFocusEvent e)
FormController to perform another
validation.focusLost in interface FormFocusListenere - the focus eventCopyright © 2016 The JGUIraffe Team. All rights reserved.