net.rim.device.api.ui.text
Class PhoneTextFilter

java.lang.Object
  |
  +--net.rim.device.api.ui.text.TextFilter
        |
        +--net.rim.device.api.ui.text.PhoneTextFilter

public class PhoneTextFilter
extends TextFilter

Filters out characters not usable in phone number text strings.

This filter recognizes as valid characters all digits, plus left and right parentheses, minus sign, plus sign, x (for extension), the space character, the number sign, the asterisk, and period, uppercase letters (for the following map). For compatibility with other systems, 'e' and 't' are also allowed.

1
2
ABC
3
DEF
4
GHI
5
JKL
6
MNO
7
PQRS
8
TUV
9
WXYZ
*
0
#


Fields inherited from class net.rim.device.api.ui.text.TextFilter
DEFAULT, EMAIL, HEXADECIMAL, INTEGER, LOWERCASE, NUMERIC, PHONE, UPPERCASE, URL
 
Constructor Summary
PhoneTextFilter()
          Constructs a new PhoneTextFilter instance.
 
Method Summary
 char convert(char character, int status)
          Passes character through phone text filter.
 boolean validate(AbstractString text)
          Determines if provided string contains valid characters.
 boolean validate(char character)
          Determines if character is a valid phone string character.
 
Methods inherited from class net.rim.device.api.ui.text.TextFilter
get
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhoneTextFilter

public PhoneTextFilter()
Constructs a new PhoneTextFilter instance.
Method Detail

convert

public char convert(char character,
                    int status)
Passes character through phone text filter.

The current behaviour of this filter is to automatically ALT the characters so that numbers, the period, and the dash are entered by default. When SHIFT is pressed, uppercase letters are returned. Holding ALT allows for 'x' to be entered (in case there is an allowable symbol on this key).

Overrides:
convert in class TextFilter
Parameters:
character - Character to translate.
status - Ignored.
Returns:
Filtered version of provided character.
Since:
JDE 3.7.0

validate

public boolean validate(char character)
Determines if character is a valid phone string character.

Overrides:
validate in class TextFilter
Parameters:
character - Character to test.
Returns:
True if the character is a valid phone string character (see this class's description); otherwise, false.
Since:
JDE 3.7.0

validate

public boolean validate(AbstractString text)
Determines if provided string contains valid characters.

This method checks each character in your provided string with validate(char) for validity. It does no checking that your string is a well formed phone number, with one exception: this method returns false if the string contains a plus sign at any position other than the first character.

Overrides:
validate in class TextFilter
Parameters:
text - String to test.
Returns:
True if each character in the string passes a validity check, or if string is null; otherwise, false.
Since:
JDE 3.7.0


Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.