All Packages Class Hierarchy This Package Previous Next Index
Class datarep.common.ValidatedTextField
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.TextComponent
|
+----java.awt.TextField
|
+----datarep.common.ValidatedTextField
- public class ValidatedTextField
- extends TextField
The ValidatedTextField class is a very useful class. It creates a text field which only accepts
a certain type of data. In addition to fundamental Java types such as int, long, etc., there
are more complex types, such as PHONE, which accept input only so that it makes a valid phone
number.
valid types are:
- Fundamental types:
- NULL
- BYTE
- SHORT
- INT
- INTEGER same as INT
- LONG
- CHAR
- CHARACTER same as CHAR
- FLOAT
- DOUBLE
- STRING
- BOOLEAN
- Complex types:
- PHONE
- SOCIAL_SECURITY
- ZIP
- ZIP4
- DOLLAR
- TIME
- DATE
- DATE2000
- IDENTIFIER
- Version:
- 1.2
- Author:
- Data Representations, Inc.
-
BOOLEAN
-
-
BYTE
-
-
CHAR
-
-
CHARACTER
-
-
DATE
-
-
DATE2000
-
-
DOLLAR
-
-
DOUBLE
-
-
FLOAT
-
-
IDENTIFIER
-
-
INT
-
-
INTEGER
-
-
LONG
-
-
MAX_TYPES
-
-
NULL
-
-
PHONE
-
-
SHORT
-
-
SOCIAL_SECURITY
-
-
STRING
-
-
TIME
-
-
ZIP
-
-
ZIP4
-
-
ValidatedTextField()
- creates a new Validated text field of type null (no validation)
-
ValidatedTextField(int)
- Creates a new Validated text field of type validationType.
-
ValidatedTextField(int, int)
- Creates a new Validated text field of specified type and with the specified number of columns.
-
ValidatedTextField(int, String)
- creates a new Validated text field of specified type, with the specified starting text.
-
ValidatedTextField(int, String, int)
-
-
booleanValue()
- returns the value of the textfield as a boolean.
-
byteValue()
- returns the value of the validated textfield as a byte.
-
charValue()
- returns the value of the validated textfield as a char.
-
doubleValue()
- returns the value of the validated textfield as a double.
-
floatValue()
- returns the value of the validated textfield as a float.
-
getValidationType()
- returns an integer corresponding to the type of validation.
-
getValue()
- getValue() returns the value of the textfield as an Object.
-
intValue()
- returns the value of the validated textfield as a integer.
-
isEmpty()
-
-
isSet()
- returns true if there is data in the validated textfield; false otherwise.
-
longValue()
- returns the value of the validated textfield as a long.
-
setValidationType(int)
- if the Validated text field is a complex type, this sets the field to contain some
dummy text demonstrating the type of input which is acceptable.
-
shortValue()
- returns the value of the validated textfield as a short.
NULL
public static final int NULL
BYTE
public static final int BYTE
SHORT
public static final int SHORT
INTEGER
public static final int INTEGER
INT
public static final int INT
LONG
public static final int LONG
CHARACTER
public static final int CHARACTER
CHAR
public static final int CHAR
FLOAT
public static final int FLOAT
DOUBLE
public static final int DOUBLE
STRING
public static final int STRING
BOOLEAN
public static final int BOOLEAN
PHONE
public static final int PHONE
SOCIAL_SECURITY
public static final int SOCIAL_SECURITY
ZIP
public static final int ZIP
ZIP4
public static final int ZIP4
DOLLAR
public static final int DOLLAR
TIME
public static final int TIME
DATE
public static final int DATE
DATE2000
public static final int DATE2000
IDENTIFIER
public static final int IDENTIFIER
MAX_TYPES
public static final int MAX_TYPES
ValidatedTextField
public ValidatedTextField()
- creates a new Validated text field of type null (no validation)
ValidatedTextField
public ValidatedTextField(int validationType)
- Creates a new Validated text field of type validationType.
ValidatedTextField
public ValidatedTextField(int validationType,
int col)
- Creates a new Validated text field of specified type and with the specified number of columns.
ValidatedTextField
public ValidatedTextField(int validationType,
String text)
- creates a new Validated text field of specified type, with the specified starting text.
ValidatedTextField
public ValidatedTextField(int validationType,
String text,
int col)
getValidationType
public int getValidationType()
- returns an integer corresponding to the type of validation.
setValidationType
public void setValidationType(int validationType)
- if the Validated text field is a complex type, this sets the field to contain some
dummy text demonstrating the type of input which is acceptable.
for example, calling setValidatationType(ValidatedTextField.PHONE) would set a field to
contain the following string: "(000)000-0000".
getValue
public Object getValue()
- getValue() returns the value of the textfield as an Object.
byteValue
public byte byteValue()
- returns the value of the validated textfield as a byte. If data inappropriate for a byte is found,
it will be converted into something reasonable.
shortValue
public short shortValue()
- returns the value of the validated textfield as a short. If data inappropriate for a short is found,
it will be converted into something reasonable.
intValue
public int intValue()
- returns the value of the validated textfield as a integer. If data inappropriate for an integer is found,
it will be converted into the most reasonable alternative. For example, "" will be converted to "0".
longValue
public long longValue()
- returns the value of the validated textfield as a long. If data inappropriate for a long is found,
it will be converted into something reasonable.
floatValue
public float floatValue()
- returns the value of the validated textfield as a float. If data inappropriate for a float is found,
it will be converted into something reasonable.
doubleValue
public double doubleValue()
- returns the value of the validated textfield as a double. If data inappropriate for a double is found,
it will be converted into something reasonable.
charValue
public char charValue()
- returns the value of the validated textfield as a char. If data inappropriate for a char is found,
an attempt will be made to return an appropriate value.
booleanValue
public boolean booleanValue()
- returns the value of the textfield as a boolean. If the validated textfield does not contain
'true' or 'false', then 'false' will be returned.
isSet
public boolean isSet()
- returns true if there is data in the validated textfield; false otherwise.
isEmpty
public boolean isEmpty()
All Packages Class Hierarchy This Package Previous Next Index