public class BaseComponentKeyStrokeTrigger<C extends Component>
extends com.google.code.validationframework.base.trigger.AbstractTrigger
implements com.google.code.validationframework.api.common.Disposable
AbstractTrigger,
Disposable| Modifier and Type | Field and Description |
|---|---|
protected C |
source
Text component that is the source of the trigger.
|
| Constructor and Description |
|---|
BaseComponentKeyStrokeTrigger(C source,
int... keyCodes)
Constructor specifying the text component to listen to and the virtual key codes to trigger the validation.
|
BaseComponentKeyStrokeTrigger(C source,
KeyStroke... keyStrokes)
Constructor specifying the text component to listen to and the key stroke to trigger the validation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addKeyStroke(KeyStroke keyStroke)
Adds a key stroke for which the validation will be triggered.
|
void |
dispose() |
C |
getComponent()
Gets the source component.
|
Collection<KeyStroke> |
getKeyStokes()
Gets the key strokes for which the validation will be triggered.
|
void |
removeKey(KeyStroke keyStroke)
Removes a key stroke for which the validation should no longer be triggered.
|
public BaseComponentKeyStrokeTrigger(C source, int... keyCodes)
If no virtual key code is provided, the trigger will initiate the validation on any key stroke.
You may refer to the KeyStroke constants to see the available virtual key codes.
source - Text component to listen to.keyCodes - Virtual key strokes to trigger the validation.BaseComponentKeyStrokeTrigger(Component, KeyStroke...),
KeyStrokepublic BaseComponentKeyStrokeTrigger(C source, KeyStroke... keyStrokes)
If no key stroke is provided, the trigger will initiate the validation on any key stroke.
source - Text component to listen to.keyStrokes - Key strokes to trigger the validation.KeyStrokepublic C getComponent()
public Collection<KeyStroke> getKeyStokes()
public void addKeyStroke(KeyStroke keyStroke)
keyStroke - Key stroke to be added to trigger the validation.KeyStrokepublic void removeKey(KeyStroke keyStroke)
If all key strokes are removed, the trigger will initiate the validation on any key stroke.
keyStroke - Key stroke to be removed.public void dispose()
dispose in interface com.google.code.validationframework.api.common.Disposabledispose in class com.google.code.validationframework.base.trigger.AbstractTriggerDisposable.dispose()Copyright © 2020. All rights reserved.