net.rim.device.api.ui.text
Class IPTextFilter
java.lang.Object
|
+--net.rim.device.api.ui.text.TextFilter
|
+--net.rim.device.api.ui.text.IPTextFilter
- public class IPTextFilter
- extends TextFilter
Filters out characters not used in IP\Port text strings
- Since:
- JDE 3.6.0
|
Field Summary |
static int |
NO_PORTS
A constant indicating that no ports are allowed in the string. |
static int |
NUMERIC_IP_ONLY
A constant indicating that if set, IP addresses can only consist of numeric characters. |
| Fields inherited from class net.rim.device.api.ui.text.TextFilter |
ADN_SIM_PHONE, DEFAULT, DEFAULT_SMART_PHONE, EMAIL, FDN_SIM_PHONE, FILENAME, HEXADECIMAL, INTEGER, IP, LOWERCASE, NUMERIC, PHONE, PIN_ADDRESS, REAL_NUMERIC, SIM_PHONE, SMS_PHONE, STYLE_SHIFT, UPPERCASE, URL, VOICEMAIL_PHONE |
|
Constructor Summary |
IPTextFilter()
Constructs new IPTextFilter object with no parameters. |
IPTextFilter(int flag)
Constructs new IPTextFilter object. |
|
Method Summary |
char |
convert(char character,
int status)
Converts a valid character to its lower case form and an invalid character to its alternate version. |
boolean |
validate(AbstractString text)
Determines if the provided string contains valid characters. |
boolean |
validate(char character)
Validates a character for use with this filter. |
NO_PORTS
public static final int NO_PORTS
- A constant indicating that no ports are allowed in the string.
- Since:
- JDE 3.6.0
NUMERIC_IP_ONLY
public static final int NUMERIC_IP_ONLY
- A constant indicating that if set, IP addresses can only consist of numeric characters.
- Since:
- JDE 3.6.0
IPTextFilter
public IPTextFilter()
- Constructs new IPTextFilter object with no parameters.
- Since:
- JDE 3.6.0
IPTextFilter
public IPTextFilter(int flag)
- Constructs new IPTextFilter object.
Takes an argument that specifies if UDP ports are allowed.
- Parameters:
flag - Flag to specify if UDP ports are allowed.- Since:
- JDE 3.6.0
convert
public char convert(char character,
int status)
- Converts a valid character to its lower case form and an invalid character to its alternate version.
- Overrides:
convert in class TextFilter
- Parameters:
character - The character to convert.status - Indicates how the character was generated: some filters use this to affect the conversion performed.- Returns:
- The lower-case form of the given alphabet character for valid characters, whether the character
was lower-case or upper-case originally. For invalid characters - returns the result of
Keypad.getAltedChar(char).
- Since:
- JDE 3.6.0
validate
public boolean validate(AbstractString text)
- Determines if the provided string contains valid characters.
- Overrides:
validate in class TextFilter
- Parameters:
text - The string with characters to validate.- Returns:
- true If each character in the text parameter is valid, or if the text parameter is an empty String or null.
- Since:
- JDE 3.6.0
validate
public boolean validate(char character)
- Validates a character for use with this filter.
If NO_PORTS flag is not set, then ':' is valid.
If NUMERIC_IP_ONLY flag is not set, then lower case characters, '-' and '.' are valid.
Upper-case alphabet characters are considered invalid.
- Overrides:
validate in class TextFilter
- Parameters:
character - The character to validate.- Returns:
- true If the character parameter is a valid IP string character.
Return false if the character parameter is an upper-case alphabet character.
- Since:
- JDE 3.6.0
Copyright 1999-2007 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.