org.eclipse.nebula.widgets.nattable.ui.matcher
Class LetterOrDigitKeyEventMatcher

java.lang.Object
  extended by 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
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
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 class SWT.
Method Detail

matches

public boolean matches(org.eclipse.swt.events.KeyEvent event)
Specified by:
matches in interface IKeyEventMatcher

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.


Copyright © 2014. All rights reserved.