com.sas.swing.visuals.util
Class ValidationUtil

com.sas.swing.visuals.util.ValidationUtil

public abstract class ValidationUtil

Validation Utility functions.


Constructor Summary
ValidationUtil()
           
 
Method Summary
static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField)
          Adds a validator to the JTextField, the default validator being a BoundedLong with Integer.MIN_VALUE and Integer.MAX_VALUE as its limits.
static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField, double minValue, double maxValue)
          Adds a validator to the JTextField, the validator being a BoundedDouble with minValue and maxValue as its limits.
static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField, double minValue, double maxValue, java.lang.String errorMessage)
          Adds a validator to the JTextField, the validator being a BoundedDouble with minValue and maxValue as its limits.
static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField, int minValue, int maxValue)
          Adds a validator to the JTextField, the validator being a BoundedLong with minValue and maxValue as its limits.
static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField, int minValue, int maxValue, java.lang.String errorMessage)
          Adds a validator to the JTextField, the validator being a BoundedLong with minValue and maxValue as its limits.
static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField, ValidationInterface validator)
          Adds a validator to the JTextField, the validator being the instance of the ValidationInterface passed in.
static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField, ValidationInterface validator, GenericErrorHandlerInterface errorHandler)
          Adds a validator to the JTextField, the validator being the instance of the ValidationInterface passed in.
static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField, ValidationInterface validator, java.lang.String errorMessage)
          Adds a validator to the JTextField, the validator being the instance of the ValidationInterface passed in.
static boolean validate(java.lang.Object obj)
          Validates the value(text) in the object with the default validator being a BoundedLong with Integer.MIN_VALUE and Integer.MAX_VALUE as its limits.
static boolean validate(java.lang.Object obj, double minValue, double maxValue)
          Validates the value(text) in the object with the validator being a BoundedDouble with minValue and maxValue as its limits.
static boolean validate(java.lang.Object obj, double minValue, double maxValue, java.lang.String errorMessage)
          Validates the value(text) in the object with the validator being a BoundedDouble with minValue and maxValue as its limits.
static boolean validate(java.lang.Object obj, int minValue, int maxValue)
          Validates the value(text) in the object with the validator being a BoundedLong with minValue and maxValue as its limits.
static boolean validate(java.lang.Object obj, int minValue, int maxValue, java.lang.String errorMessage)
          Validates the value(text) in the object with the validator being a BoundedLong with minValue and maxValue as its limits.
static boolean validate(java.lang.Object obj, ValidationInterface validator)
          Validates the value(text) in the object with the validator being the instance of ValidationInterface passed in.
static boolean validate(java.lang.Object obj, ValidationInterface validator, GenericErrorHandlerInterface errorHandler)
          Validates the value(text) in the object with the validator being the instance of ValidationInterface passed in.
static boolean validate(java.lang.Object obj, ValidationInterface validator, java.lang.String errorMessage)
          Validates the value(text) in the object with the validator being the instance of ValidationInterface passed in.
 

Constructor Detail

ValidationUtil

public ValidationUtil()
Method Detail

addJTextFieldValidator

public static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField)
Adds a validator to the JTextField, the default validator being a BoundedLong with Integer.MIN_VALUE and Integer.MAX_VALUE as its limits. The default error handler used is the JOptionPaneErrorHandler. A FocusListener and a ActionListener and added to the JTextField to listen to the updates made to the text. An instance of the JTextFieldValidator is returned for the user to use to add a PropertyChangeListener to.

Parameters:
textField - The JTextField to preform the validating on whenever the JTextField fires a focusLost or actionPerformed event.
See Also:
BoundedLong, JTextField, GenericErrorHandlerInterface, ValidationInterface, JTextFieldValidator

addJTextFieldValidator

public static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField,
                                                         double minValue,
                                                         double maxValue)
Adds a validator to the JTextField, the validator being a BoundedDouble with minValue and maxValue as its limits. The default error handler used is the JOptionPaneErrorHandler. A FocusListener and a ActionListener and added to the JTextField to listen to the updates made to the text. An instance of the JTextFieldValidator is returned for the user to use to add a PropertyChangeListener to.

Parameters:
textField - The JTextField to preform the validating on whenever the JTextField fires a focusLost or actionPerformed event.
minValue - The minimum value limit used on the validator
maxValue - The maximum value limit used on the validator
Returns:
The instance of the JTextFieldValidator that will fire a PropertyChangeEvent with a propertyName of valid whenever a check is made on the text in the JTextField
See Also:
BoundedDouble, JTextField, GenericErrorHandlerInterface, ValidationInterface, JTextFieldValidator

addJTextFieldValidator

public static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField,
                                                         double minValue,
                                                         double maxValue,
                                                         java.lang.String errorMessage)
Adds a validator to the JTextField, the validator being a BoundedDouble with minValue and maxValue as its limits. The default error handler used is the JOptionPaneErrorHandler. A FocusListener and a ActionListener and added to the JTextField to listen to the updates made to the text. An instance of the JTextFieldValidator is returned for the user to use to add a PropertyChangeListener to.

Parameters:
textField - The JTextField to preform the validating on whenever the JTextField fires a focusLost or actionPerformed event.
minValue - The minimum value limit used on the validator
maxValue - The maximum value limit used on the validator
errorMessage - The error message to display in the error-handler, used instead of the default message of the validator
Returns:
The instance of the JTextFieldValidator that will fire a PropertyChangeEvent with a propertyName of valid whenever a check is made on the text in the JTextField
See Also:
BoundedDouble, JTextField, GenericErrorHandlerInterface, ValidationInterface, JTextFieldValidator

addJTextFieldValidator

public static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField,
                                                         int minValue,
                                                         int maxValue)
Adds a validator to the JTextField, the validator being a BoundedLong with minValue and maxValue as its limits. The default error handler used is the JOptionPaneErrorHandler. A FocusListener and a ActionListener and added to the JTextField to listen to the updates made to the text. An instance of the JTextFieldValidator is returned for the user to use to add a PropertyChangeListener to.

Parameters:
textField - The JTextField to preform the validating on whenever the JTextField fires a focusLost or actionPerformed event.
minValue - The minimum value limit used on the validator
maxValue - The maximum value limit used on the validator
Returns:
The instance of the JTextFieldValidator that will fire a PropertyChangeEvent with a propertyName of valid whenever a check is made on the text in the JTextField
See Also:
BoundedLong, JTextField, GenericErrorHandlerInterface, ValidationInterface, JTextFieldValidator

addJTextFieldValidator

public static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField,
                                                         int minValue,
                                                         int maxValue,
                                                         java.lang.String errorMessage)
Adds a validator to the JTextField, the validator being a BoundedLong with minValue and maxValue as its limits. The default error handler used is the JOptionPaneErrorHandler. A FocusListener and a ActionListener and added to the JTextField to listen to the updates made to the text. An instance of the JTextFieldValidator is returned for the user to use to add a PropertyChangeListener to.

Parameters:
textField - The JTextField to preform the validating on whenever the JTextField fires a focusLost or actionPerformed event.
minValue - The minimum value limit used on the validator
maxValue - The maximum value limit used on the validator
errorMessage - The error message to display in the error-handler, used instead of the default message of the validator
Returns:
The instance of the JTextFieldValidator that will fire a PropertyChangeEvent with a propertyName of valid whenever a check is made on the text in the JTextField
See Also:
BoundedLong, JTextField, GenericErrorHandlerInterface, ValidationInterface, JTextFieldValidator

addJTextFieldValidator

public static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField,
                                                         ValidationInterface validator)
Adds a validator to the JTextField, the validator being the instance of the ValidationInterface passed in. The default error handler used is the JOptionPaneErrorHandler. A FocusListener and a ActionListener and added to the JTextField to listen to the updates made to the text. An instance of the JTextFieldValidator is returned for the user to use to add a PropertyChangeListener to.

Parameters:
textField - The JTextField to preform the validating on whenever the JTextField fires a focusLost or actionPerformed event.
validator - The instance of ValidationInterface to preform the validating whenever the JTextField fires a focusLost or actionPerformed event.
Returns:
The instance of the JTextFieldValidator that will fire a PropertyChangeEvent with a propertyName of valid whenever a check is made on the text in the JTextField
See Also:
JTextField, GenericErrorHandlerInterface, ValidationInterface, JTextFieldValidator

addJTextFieldValidator

public static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField,
                                                         ValidationInterface validator,
                                                         java.lang.String errorMessage)
Adds a validator to the JTextField, the validator being the instance of the ValidationInterface passed in. The default error handler used is the JOptionPaneErrorHandler. A FocusListener and a ActionListener and added to the JTextField to listen to the updates made to the text. An instance of the JTextFieldValidator is returned for the user to use to add a PropertyChangeListener to.

Parameters:
textField - The JTextField to preform the validating on whenever the JTextField fires a focusLost or actionPerformed event.
validator - The instance of ValidationInterface to preform the validating whenever the JTextField fires a focusLost or actionPerformed event.
errorMessage - The error message to display in the error-handler, used instead of the default message of the validator
Returns:
The instance of the JTextFieldValidator that will fire a PropertyChangeEvent with a propertyName of valid whenever a check is made on the text in the JTextField
See Also:
JTextField, GenericErrorHandlerInterface, ValidationInterface, JTextFieldValidator

addJTextFieldValidator

public static JTextFieldValidator addJTextFieldValidator(javax.swing.JTextField textField,
                                                         ValidationInterface validator,
                                                         GenericErrorHandlerInterface errorHandler)
Adds a validator to the JTextField, the validator being the instance of the ValidationInterface passed in. The default error handler used is the JOptionPaneErrorHandler. A FocusListener and a ActionListener and added to the JTextField to listen to the updates made to the text. An instance of the JTextFieldValidator is returned for the user to use to add a PropertyChangeListener to.

Parameters:
textField - The JTextField to preform the validating on whenever the JTextField fires a focusLost or actionPerformed event.
validator - The instance of ValidationInterface to preform the validating whenever the JTextField fires a focusLost or actionPerformed event.
errorHandler - The error handle used to display any error messages whenever an invalid value is entered
Returns:
The instance of the JTextFieldValidator that will fire a PropertyChangeEvent with a propertyName of valid whenever a check is made on the text in the JTextField
See Also:
JTextField, GenericErrorHandlerInterface, ValidationInterface, JTextFieldValidator

validate

public static boolean validate(java.lang.Object obj)
Validates the value(text) in the object with the default validator being a BoundedLong with Integer.MIN_VALUE and Integer.MAX_VALUE as its limits. The default error handler used is the JOptionPaneErrorHandler.

Parameters:
obj - The Object (which needs to be an instance of JTextComponent) to preform the validating on
Returns:
true if the value is valid, false otherwise
See Also:
BoundedLong, JTextComponent, GenericErrorHandlerInterface, ValidationInterface

validate

public static boolean validate(java.lang.Object obj,
                               double minValue,
                               double maxValue)
Validates the value(text) in the object with the validator being a BoundedDouble with minValue and maxValue as its limits. The default error handler used is the JOptionPaneErrorHandler.

Parameters:
obj - The Object (which needs to be an instance of JTextComponent) to preform the validating on
minValue - The minimum value limit used on the validator
maxValue - The maximum value limit used on the validator
Returns:
true if the value is valid, false otherwise
See Also:
BoundedDouble, JTextComponent, GenericErrorHandlerInterface, ValidationInterface

validate

public static boolean validate(java.lang.Object obj,
                               double minValue,
                               double maxValue,
                               java.lang.String errorMessage)
Validates the value(text) in the object with the validator being a BoundedDouble with minValue and maxValue as its limits. The default error handler used is the JOptionPaneErrorHandler.

Parameters:
obj - The Object (which needs to be an instance of JTextComponent) to preform the validating on
minValue - The minimum value limit used on the validator
maxValue - The maximum value limit used on the validator
errorMessage - The error message to display in the error-handler, used instead of the default message of the validator
Returns:
true if the value is valid, false otherwise
See Also:
BoundedDouble, JTextComponent, GenericErrorHandlerInterface, ValidationInterface

validate

public static boolean validate(java.lang.Object obj,
                               int minValue,
                               int maxValue)
Validates the value(text) in the object with the validator being a BoundedLong with minValue and maxValue as its limits. The default error handler used is the JOptionPaneErrorHandler.

Parameters:
obj - The Object (which needs to be an instance of JTextComponent) to preform the validating on
minValue - The minimum value limit used on the validator
maxValue - The maximum value limit used on the validator
Returns:
true if the value is valid, false otherwise
See Also:
BoundedLong, JTextComponent, GenericErrorHandlerInterface, ValidationInterface

validate

public static boolean validate(java.lang.Object obj,
                               int minValue,
                               int maxValue,
                               java.lang.String errorMessage)
Validates the value(text) in the object with the validator being a BoundedLong with minValue and maxValue as its limits. The default error handler used is the JOptionPaneErrorHandler.

Parameters:
obj - The Object (which needs to be an instance of JTextComponent) to preform the validating on
minValue - The minimum value limit used on the validator
maxValue - The maximum value limit used on the validator
errorMessage - The error message to display in the error-handler, used instead of the default message of the validator
Returns:
true if the value is valid, false otherwise
See Also:
BoundedLong, JTextComponent, GenericErrorHandlerInterface, ValidationInterface

validate

public static boolean validate(java.lang.Object obj,
                               ValidationInterface validator)
Validates the value(text) in the object with the validator being the instance of ValidationInterface passed in. The default error handler used is the JOptionPaneErrorHandler.

Parameters:
obj - The Object (which needs to be an instance of JTextComponent) to preform the validating on
validator - The instance of ValidationInterface to preform the validating with
Returns:
true if the value is valid, false otherwise
See Also:
BoundedDouble, JTextComponent, GenericErrorHandlerInterface, ValidationInterface

validate

public static boolean validate(java.lang.Object obj,
                               ValidationInterface validator,
                               java.lang.String errorMessage)
Validates the value(text) in the object with the validator being the instance of ValidationInterface passed in. The default error handler used is the JOptionPaneErrorHandler.

Parameters:
obj - The Object (which needs to be an instance of JTextComponent) to preform the validating on
validator - The instance of ValidationInterface to preform the validating with
errorMessage - The error message to display in the error-handler, used instead of the default message of the validator
Returns:
true if the value is valid, false otherwise
See Also:
BoundedDouble, JTextComponent, GenericErrorHandlerInterface, ValidationInterface

validate

public static boolean validate(java.lang.Object obj,
                               ValidationInterface validator,
                               GenericErrorHandlerInterface errorHandler)
Validates the value(text) in the object with the validator being the instance of ValidationInterface passed in. The default error handler used is the instance passed in.

Parameters:
obj - The Object (which needs to be an instance of JTextComponent) to preform the validating on
validator - The instance of ValidationInterface to preform the validating with
errorHandler - The instance of GenericErrorHandlerInterface to display the error if the value is invalid
Returns:
true if the value is valid, false otherwise
See Also:
BoundedDouble, JTextComponent, GenericErrorHandlerInterface, ValidationInterface



Copyright © 2009 SAS Institute Inc. All Rights Reserved.