|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.ui.text.TextFilter
public abstract class TextFilter
Defines fundamental functionality for a text filtering object. Objects are cached upon creation.
A filter has two functions: first, it can validate whether a character or string is valid, and second it can map characters onto ones more likely to be valid.
| Field Summary | ||
|---|---|---|
static int |
ADN_SIM_PHONE
ADN stands for Abbreviated Dialing Number, the standard SIM phone book. |
|
static int |
DEFAULT
Default filter type. |
|
static int |
DEFAULT_SMART_PHONE
Default smart phone number edit field filter. |
|
static int |
EMAIL
Email address filter. |
|
static int |
FDN_SIM_PHONE
FDN stands for Fixed Dialing Number, the secure SIM phone book. |
|
static int |
FILENAME
Filename filter that accepts alphanumeric characters without special chars or accents. |
|
static int |
HEXADECIMAL
Hex character set filter. |
|
static int |
INTEGER
Numeric filter that also allows for a minus sign. |
|
static int |
IP
IP Address filters out characters not used in IP\Port text strings |
|
static int |
LOWERCASE
Lowercase alpha character filter |
|
static int |
NUMERIC
Common numeric filter. |
|
static int |
PHONE
A generous phone number filter |
|
static int |
PIN_ADDRESS
PIN address filter type. |
|
static int |
REAL_NUMERIC
Numeric filter that also allows for a minus sign and decimal point. |
|
static int |
SIM_PHONE
Same as ADN_SIM_PHONE. |
|
static int |
SMS_PHONE
SMS (Short Message Service) phone number filter |
|
static byte |
STYLE_SHIFT
Defines where filters get placed in the style parameter of EidtField. |
|
static int |
UPPERCASE
Uppercase alpha character filter |
|
static int |
URL
URL (Universal Resource Locator) filter. |
|
static int |
VOICEMAIL_PHONE
Default voicemail and call forwarding phone number edit field filter. |
|
| Constructor Summary | ||
|---|---|---|
protected |
TextFilter()
Constructs a new TextFilter instance. |
|
| Method Summary | ||
|---|---|---|
abstract char |
convert(char character,
int status)
Retrieves filtered version of provided character. |
|
char |
convert(char character,
AbstractString text,
int position,
int status)
Retrieves filtered version of provided character. |
|
static TextFilter |
get(int type)
Retrieve a filter of provided type. |
|
abstract boolean |
validate(char character)
Validates character for use with this filter. |
|
boolean |
validate(char character,
AbstractString text,
int position)
Validates character for use with this filter. |
|
boolean |
validate(AbstractString text)
Determines if provided string contains valid characters. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT
public static final int NUMERIC
NumericTextFilter.NumericTextFilter(),
Constant Field Valuespublic static final int UPPERCASE
UppercaseTextFilter.UppercaseTextFilter(),
Constant Field Valuespublic static final int LOWERCASE
LowercaseTextFilter.LowercaseTextFilter(),
Constant Field Valuespublic static final int HEXADECIMAL
HexadecimalTextFilter.HexadecimalTextFilter(),
Constant Field Valuespublic static final int INTEGER
NumericTextFilter.NumericTextFilter(),
NumericTextFilter.ALLOW_NEGATIVE,
Constant Field Valuespublic static final int PHONE
PhoneTextFilter.PhoneTextFilter(),
PhoneTextFilter.ACCEPT_EVERYTHING_EXCEPT_WILD_CARD,
Constant Field Valuespublic static final int URL
URLTextFilter.URLTextFilter(),
Constant Field Valuespublic static final int EMAIL
EmailAddressTextFilter.EmailAddressTextFilter(),
Constant Field Valuespublic static final int PIN_ADDRESS
PINAddressTextFilter#PINAddressTextFilter(),
Constant Field Valuespublic static final int ADN_SIM_PHONE
PhoneTextFilter.PhoneTextFilter(int),
PhoneTextFilter.ACCEPT_PAUSE,
PhoneTextFilter.ACCEPT_CONTROL,
PhoneTextFilter.ACCEPT_INTERNATIONAL,
Constant Field Valuespublic static final int SIM_PHONE
public static final int FDN_SIM_PHONE
PhoneTextFilter.PhoneTextFilter(int),
PhoneTextFilter.ACCEPT_PAUSE,
PhoneTextFilter.ACCEPT_CONTROL,
PhoneTextFilter.ACCEPT_WILD_CARD,
PhoneTextFilter.ACCEPT_INTERNATIONAL,
Constant Field Valuespublic static final int SMS_PHONE
PhoneTextFilter.PhoneTextFilter(int),
PhoneTextFilter.ACCEPT_INTERNATIONAL,
Constant Field Valuespublic static final int DEFAULT_SMART_PHONE
PhoneTextFilter.PhoneTextFilter(int),
PhoneTextFilter.ACCEPT_CONTROL,
PhoneTextFilter.ACCEPT_CONTROL,
PhoneTextFilter.ACCEPT_ALPHA,
PhoneTextFilter.ACCEPT_FORMATTING,
PhoneTextFilter.ACCEPT_INTERNATIONAL,
Constant Field Valuespublic static final int VOICEMAIL_PHONE
PhoneTextFilter.PhoneTextFilter(int),
PhoneTextFilter.ACCEPT_CONTROL,
PhoneTextFilter.ACCEPT_INTERNATIONAL,
Constant Field Valuespublic static final int REAL_NUMERIC
NumericTextFilter.NumericTextFilter(int),
NumericTextFilter.ALLOW_DECIMAL,
NumericTextFilter.ALLOW_NEGATIVE,
Constant Field Valuespublic static final int FILENAME
FilenameTextFilter,
Constant Field Valuespublic static final int IP
IPTextFilter,
Constant Field Valuespublic static final byte STYLE_SHIFT
| Constructor Detail |
|---|
protected TextFilter()
| Method Detail |
|---|
public abstract char convert(char character,
int status)
This method may not return a character valid for this filter; however, it may return 0 to indicate that the provided character is not valid.
For example, an UppercaseTextFilter would convert any lower case character to its
upper case equivalent. However, if passed a number it could either leave the number
unchanged to be filtered by TextFilter.validate(char), or convert it to \u0000.
character - Character to convert.status - Indicates how the character was generated: some filters use this to affect the conversion performed; * this will be a bitwise-or combination of the STATUS_ constants defined
in KeypadListener.
public char convert(char character,
AbstractString text,
int position,
int status)
This method may not return a character valid for this filter; however, it may return 0 to indicate that the provided character is not valid.
For example, an UppercaseTextFilter would convert any lower case character to its
upper case equivalent. However, if passed a number it could either leave the number
unchanged to be filtered by TextFilter.validate(char), or convert it to \u0000.
This method is overridden in NumericTextFilter for more precise validation.
character - Character to convert.text - Text in the current edit field.position - Current position of cursor in text.status - Indicates how the character was generated: some filters use this to affect the conversion performed; * this will be a bitwise-or combination of the STATUS_ constants defined
in KeypadListener.
public static final TextFilter get(int type)
Factory method that produces a text filter of your specified type.
type - Type of filter you want.
TextFilter.DEFAULT for type, or an invalid type.public abstract boolean validate(char character)
This only considers if it is in the correct set of characters.
character - Character to test.
public boolean validate(char character,
AbstractString text,
int position)
By default this only considers if it is in the correct set of characters.
It is overwritten in NumericTextFilter for more precise validation.
character - Character to test.text - Text in the current edit field.position - Current position of cursor in text.
public boolean validate(AbstractString text)
The default implementation of this method returns true if each
character is valid within the field (determined by invoking
TextFilter.validate(char). This is useful for upper case or lower case
filters, for example, but filters that rely on character position must
override this method.
text - String to test.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal