Class InputVerifier
java.lang.Object
vaadinx.swing.InputVerifier
Port of
InputVerifier. Abstract class user code
subclasses to validate a field before focus leaves it; we port rather
than reuse the JDK class because verify(JComponent) references
Component (D_whitelist_porting/D_event_port_policy — types touching the Component hierarchy must live
in vaadinx so our emulators can be passed through).
Wired in by JComponent.setInputVerifier(InputVerifier): the peer's blur
listener calls shouldYieldFocus(JComponent) on focus-lost; a false return
restores focus to the component so the user corrects the field before
moving on. The two-arg overload lets a verifier inspect the target of
the focus change — in a Vaadin context the target isn't always known
(browser focus may go to a non-peer element), so the default falls
through to the single-arg form.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanshouldYieldFocus(JComponent input) Called byJComponent's focus plumbing when focus would leaveinput.booleanshouldYieldFocus(JComponent source, JComponent target) Two-arg overload that takes the focus target.abstract booleanverify(JComponent input) Check whether the input ininputis valid.
-
Constructor Details
-
InputVerifier
public InputVerifier()
-
-
Method Details
-
verify
Check whether the input ininputis valid. Returningfalseprevents focus from leaving the component. -
shouldYieldFocus
Called byJComponent's focus plumbing when focus would leaveinput. JDK's default delegates toverify(JComponent); override if you want to allow focus to move even when verify fails (e.g. to let the user cancel out via Escape). -
shouldYieldFocus
Two-arg overload that takes the focus target. JDK's default calls the single-argshouldYieldFocus(JComponent)and dropstarget— matching so migration code overriding either signature works.
-