com.isti.util.gui.textvalidator
Class TextBasicValidator

java.lang.Object
  extended by com.isti.util.gui.textvalidator.TextBasicValidator
All Implemented Interfaces:
AllowedCharactersConstants, TextValidator, StringConstants
Direct Known Subclasses:
TextMinMaxValidator, TextSQLDateValidator, TextSQLTimestampValidator, TextSQLTimeValidator

public class TextBasicValidator
extends java.lang.Object
implements TextValidator

Class TextNumberValidator defines methods to validate text.


Field Summary
 
Fields inherited from interface com.isti.util.StringConstants
ALPHA_CAP_CHARS, ALPHA_CHARS, ALPHA_LOW_CHARS, ALPHANUM_CHARS_STRING, ALPHANUMERIC_CHARS, BOOLEAN_FALSE_TEXT, BOOLEAN_TRUE_TEXT, DATE_FORMAT_AMPM_STR, DATE_FORMAT_RFC_822_STR, DATE_FORMAT24_STR, DEFAULT_JAVA_VERSION_STRING, DEFAULT_NULL_STR, DEFAULT_SEP_STR, EFLOAT_CHARS, EMPTY_STRING, FLOAT_CHARS, HEX_ALPHA_CAP_CHARS, HEX_ALPHA_LOW_CHARS, HEX_CHARS, INTEGER_CHARS, INVALID_FILENAME_CHARS, QUOTE_STRING, SIGNED_EFLOAT_CHARS, SIGNED_FLOAT_CHARS, SIGNED_INT_CHARS, SPACE_STRING, TOD_CHARS, WHITE_SPACE_CHARS, WILDCARD_ALL_CHAR, WILDCARD_CHARS, WILDCARD_SINGLE_CHAR
 
Constructor Summary
TextBasicValidator()
          Creates a basic text validator.
TextBasicValidator(int maxTextLength)
          Creates a basic text validator.
TextBasicValidator(int[] allowedNumChars)
          Creates a basic text validator.
TextBasicValidator(java.lang.String specialChars, int numColumns, java.lang.String toolTipText, boolean numericFlag, int maxNumChars, boolean allowedFlag)
          Creates a basic text validator.
 
Method Summary
 boolean getAllowedFlag()
          Gets the allowed flag.
 int getColumns()
          Gets the number of columns.
 int getMaxNumChars()
          Gets the maximum number of characters.
 java.lang.String getSpecialChars()
          Gets the allowed (or not allowed) special characters.
 java.lang.String getToolTipText()
          Gets the tool tip text.
 boolean isNumeric()
          Determines if the characters represent a numeric value.
 boolean isValid(java.lang.String s)
          Determines if the text is valid.
 boolean isValidEntry(java.lang.String s)
          Determines if the text entry is valid.
 void setAllowedFlag(boolean b)
          Sets the allowed flag.
 void setColumns(int numColumns)
          Sets the number of columns.
 void setMaxNumChars(int maxNumChars)
          Sets the maximum number of characters.
 void setMaxTextLength(int maxTextLength)
          Set the maximum text length.
 void setNumericFlag(boolean b)
          Determines if the characters represent a numeric value.
 void setSpecialChars(java.lang.String specialChars)
          Sets the allowed (or not allowed) special characters.
 void setToolTipText(java.lang.String toolTipText)
          Sets the tool tip text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextBasicValidator

public TextBasicValidator()
Creates a basic text validator.


TextBasicValidator

public TextBasicValidator(int maxTextLength)
Creates a basic text validator. This will set the number of columns and the maximum number of characters to the specified amount.

Parameters:
maxTextLength - the maximum number of characters or 0 if none.
See Also:
setMaxTextLength

TextBasicValidator

public TextBasicValidator(int[] allowedNumChars)
Creates a basic text validator.

Parameters:
allowedNumChars - the array of allowed number of characters or null if all.

TextBasicValidator

public TextBasicValidator(java.lang.String specialChars,
                          int numColumns,
                          java.lang.String toolTipText,
                          boolean numericFlag,
                          int maxNumChars,
                          boolean allowedFlag)
Creates a basic text validator.

Parameters:
specialChars - the the allowed (or not allowed) special characters or null for all.
numColumns - the number of columns or -1 for the default.
toolTipText - the tool tip text or null if none.
numericFlag - true if the characters represent a numeric value, false otherwise.
maxNumChars - the maximum number of characters or 0 if none.
allowedFlag - true to allow only the special characters, false to not allow the special characters.
Method Detail

getAllowedFlag

public boolean getAllowedFlag()
Gets the allowed flag.

Specified by:
getAllowedFlag in interface TextValidator
Returns:
true to allow only the special characters, false to not allow the special characters.
See Also:
getSpecialChars()

getColumns

public int getColumns()
Gets the number of columns.

Specified by:
getColumns in interface TextValidator
Returns:
the number of columns or -1 for the default.

getMaxNumChars

public int getMaxNumChars()
Gets the maximum number of characters.

Specified by:
getMaxNumChars in interface TextValidator
Returns:
the maximum number of characters or 0 if none.

getSpecialChars

public java.lang.String getSpecialChars()
Gets the allowed (or not allowed) special characters. If there are no special characters then all characters are allowed.

Specified by:
getSpecialChars in interface TextValidator
Returns:
the allowed characters or null for none.
See Also:
getAllowedFlag()

getToolTipText

public java.lang.String getToolTipText()
Gets the tool tip text.

Specified by:
getToolTipText in interface TextValidator
Returns:
the tool tip text or null if none.

isNumeric

public boolean isNumeric()
Determines if the characters represent a numeric value.

Specified by:
isNumeric in interface TextValidator
Returns:
true if numeric value, false otherwise

isValid

public boolean isValid(java.lang.String s)
Determines if the text is valid. The text may be only part of the entire text entry.

Specified by:
isValid in interface TextValidator
Parameters:
s - the text.
Returns:
true if the text is valid, false otherwise.

isValidEntry

public boolean isValidEntry(java.lang.String s)
Determines if the text entry is valid. The text should be the entire text entry.

Specified by:
isValidEntry in interface TextValidator
Parameters:
s - the text.
Returns:
true if the text is valid, false otherwise.

setAllowedFlag

public void setAllowedFlag(boolean b)
Sets the allowed flag.

Parameters:
b - true to allow only the special characters, false to not allow the special characters.
See Also:
getAllowedFlag()

setColumns

public void setColumns(int numColumns)
Sets the number of columns.

Parameters:
numColumns - the number of columns or -1 for the default.
See Also:
getColumns()

setMaxNumChars

public void setMaxNumChars(int maxNumChars)
Sets the maximum number of characters.

Parameters:
maxNumChars - the maximum number of characters or 0 if none.
See Also:
getMaxNumChars()

setMaxTextLength

public final void setMaxTextLength(int maxTextLength)
Set the maximum text length. This will set the number of columns and the maximum number of characters to the specified amount.

Parameters:
maxTextLength - the maximum text length.
See Also:
setColumns, setMaxNumChars

setNumericFlag

public void setNumericFlag(boolean b)
Determines if the characters represent a numeric value.

Parameters:
b - true if the characters represent a numeric value, false otherwise.
See Also:
isNumeric()

setSpecialChars

public void setSpecialChars(java.lang.String specialChars)
Sets the allowed (or not allowed) special characters. If there are no special characters then all characters are allowed.

Parameters:
specialChars - the the allowed (or not allowed) special characters or null for all.
See Also:
getSpecialChars()

setToolTipText

public void setToolTipText(java.lang.String toolTipText)
Sets the tool tip text.

Parameters:
toolTipText - the tool tip text or null if none.
See Also:
getToolTipText()