Class LetterOrDigitKeyEventMatcher
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.ui.matcher.LetterOrDigitKeyEventMatcher
-
- All Implemented Interfaces:
IKeyEventMatcher
public class LetterOrDigitKeyEventMatcher extends Object implements IKeyEventMatcher
IKeyEventMatcher
implementation that will check if a pressed key is a letter or digit key, in combination with the configured state mask for the keyboard modifier.Since 1.0.0 this matcher has evolved to match more than only letter or digit keys. It will now also check for several special characters that are able to be populated to an editor like e.g. the question mark. The following regular expression will be used by this matcher: [\\.:,;\\-_#\'+*~!?ยง$%&/()\\[\\]\\{\\}=\\\\\"]
-
-
Constructor Summary
Constructors Constructor Description LetterOrDigitKeyEventMatcher()
Will create a new key event matcher that accepts no keyboard modifiers on typing a key.LetterOrDigitKeyEventMatcher(int stateMask)
Will create a new key event matcher that accepts only the given keyboard modifiers on typing a key.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
isLetterOrDigit(char character)
Will check if the given character is a letter or digit character, and moreover will check special characters that can be typed that will cause a character to be printed.boolean
matches(org.eclipse.swt.events.KeyEvent event)
-
-
-
Constructor Detail
-
LetterOrDigitKeyEventMatcher
public LetterOrDigitKeyEventMatcher()
Will create a new key event matcher that accepts no keyboard modifiers on typing a key.
-
LetterOrDigitKeyEventMatcher
public LetterOrDigitKeyEventMatcher(int stateMask)
Will create a new key event matcher that accepts only the given keyboard modifiers on typing a key.- Parameters:
stateMask
- The state of the keyboard modifier keys at the time the event was generated, as defined by the key code constants in classSWT
.
-
-
Method Detail
-
matches
public boolean matches(org.eclipse.swt.events.KeyEvent event)
- Specified by:
matches
in interfaceIKeyEventMatcher
-
isLetterOrDigit
public static boolean isLetterOrDigit(char character)
Will check if the given character is a letter or digit character, and moreover will check special characters that can be typed that will cause a character to be printed.This method is intended to be used to determine whether a keypress is able to open an editor, populating the representing character of the key to the editor.
- Parameters:
character
- The character to check if it is a letter, digit or specified special character.- Returns:
true
if the character is an acceptable character,false
if not.
-
-