Class SimpleFilterAndReplaceKeyPressHandler
java.lang.Object
de.knightsoftnet.mtwidgets.client.ui.handler.AbstractFilterAndReplaceKeyPressHandler
de.knightsoftnet.mtwidgets.client.ui.handler.SimpleFilterAndReplaceKeyPressHandler
- All Implemented Interfaces:
com.google.gwt.event.dom.client.KeyPressHandler,com.google.gwt.event.shared.EventHandler
- Direct Known Subclasses:
PostalCodeKeyPressHandler,RegExKeyPressHandler,TaxNumberKeyPressHandler,TinKeyPressHandler,VatIdKeyPressHandler
Simple key press handler which limits input to allowed characters.
- Author:
- Manfred Tremmel
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleFilterAndReplaceKeyPressHandler(String allowedCharacters, boolean pallowCopyAndPast) constructor initializing fields.SimpleFilterAndReplaceKeyPressHandler(Set<Character> allowedCharacters, boolean allowCopyAndPast) constructor initializing fields. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisAllowedCharacter(char character) check if character is allowed to type in unchanged.booleanisCharacterToReplace(char character) check if character is one which has to be replaced.charreplaceCharacter(char character) replace character by another.protected final voidsetAllowedCharacters(String allowedCharacters) protected final voidsetAllowedCharacters(Set<Character> allowedCharacters) Methods inherited from class de.knightsoftnet.mtwidgets.client.ui.handler.AbstractFilterAndReplaceKeyPressHandler
onKeyPress
-
Constructor Details
-
SimpleFilterAndReplaceKeyPressHandler
public SimpleFilterAndReplaceKeyPressHandler(Set<Character> allowedCharacters, boolean allowCopyAndPast) constructor initializing fields.- Parameters:
allowedCharacters- characters which are allowed to addallowCopyAndPast- is copy and paste allowed?
-
SimpleFilterAndReplaceKeyPressHandler
constructor initializing fields.- Parameters:
allowedCharacters- characters which are allowed to addpallowCopyAndPast- is copy and paste allowed?
-
-
Method Details
-
getAllowedCharacters
-
setAllowedCharacters
-
setAllowedCharacters
-
isAllowedCharacter
public boolean isAllowedCharacter(char character) Description copied from class:AbstractFilterAndReplaceKeyPressHandlercheck if character is allowed to type in unchanged.- Specified by:
isAllowedCharacterin classAbstractFilterAndReplaceKeyPressHandler- Parameters:
character- character to check- Returns:
- true if it's allowed
-
isCharacterToReplace
public boolean isCharacterToReplace(char character) Description copied from class:AbstractFilterAndReplaceKeyPressHandlercheck if character is one which has to be replaced.- Specified by:
isCharacterToReplacein classAbstractFilterAndReplaceKeyPressHandler- Parameters:
character- character to check- Returns:
- true if character has to be replaced
-
replaceCharacter
public char replaceCharacter(char character) Description copied from class:AbstractFilterAndReplaceKeyPressHandlerreplace character by another.- Specified by:
replaceCharacterin classAbstractFilterAndReplaceKeyPressHandler- Parameters:
character- character to replace- Returns:
- replaced character
-