| java.lang.Object net.xoetrope.xui.validation.XValidationHandler
XValidationHandler | public class XValidationHandler implements XValidationExceptionHandler(Code) | | Provides a means of managing validations. This class is
intended as a mixin class for the panel classes such as XPage. Validations
are integrated with the event handler so that when the event with which the
validation is associated is triggered the validation is invoked. Failure of
a validation results in subsequent event handler methods being blocked.
Validations are also invoked at page transition and all validations rules
are checked. If all validations are not passed then the page transition
can be blocked. If a validation failes then an exception is thrown.
The exception is by default handled by this class but it can be redirected to
a custom exception handler with the setExceptionHandler method. This interface
allows exceptions to handled in a variety of different ways.
Copyright: Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt
$Revision: 1.6 $
|
Method Summary | |
public int | accumulateMessages(boolean accumulate, int level) informs the handler when a page validation is starting or stopping. | public XValidator | addValidation(Component comp, String validationName, String method, int mask) Adds a validation to this page. | public XValidator | addValidation(Component comp, String validationName, String method) Adds a validation to this page. | public XValidator | addValidation(Component comp, String validationName) Adds a validation to this page. | public int | checkValidations() Check all validations for this page. | public void | clearValidations() | public XValidator | getValidation(String validationName, String method, int mask) Adds a validation to this page. | public XValidator | getValidation(String validationName, String method) Gets a XValidator object. | public Vector | getValidations(Component comp) | public boolean | handleException(Component comp, Exception ex, XValidator validator) A method called when a validation exeption has been trapped.
Parameters: c - Component being validated Parameters: ex - The exception caused Parameters: validator - The validator being used to validate. | public void | setEventHandler(XEventHandler eh) Set the event handler instance. | public void | setExceptionHandler(XValidationExceptionHandler eh) | public void | setValidationFactory(XValidationFactory vf) | public int | validationHandler() Invoke the validators for the last event. |
XValidationHandler | public XValidationHandler(Container c)(Code) | | Create a new validation handler for the specified container. The container
provides the context in which the validation operate. Therefore validation
methods are found by reflection in the specified container. Normally the
container is the current XPage or a derived class.
Parameters: c - the container |
accumulateMessages | public int accumulateMessages(boolean accumulate, int level)(Code) | | informs the handler when a page validation is starting or stopping. Typically
when it starts the page will begin to accumulate messages which are to be displayed.
When the parameter is false the page will usually display the accumulated
messages
Parameters: start - boolean to indicate whether the accumulation is started or stopped. |
addValidation | public XValidator addValidation(Component comp, String validationName, String method, int mask)(Code) | | Adds a validation to this page.
Parameters: comp - the component being validated Parameters: validationName - the name of the validation in the validation file Parameters: method - the method used to get the component's value if any Parameters: mask - the event mask used to filter the events that trigger the validation the new and initialized XValidator |
addValidation | public XValidator addValidation(Component comp, String validationName, String method)(Code) | | Adds a validation to this page. It is assumed that the validation will be
invoked in response to FocusEvent.FOCUS_LOST events
Parameters: comp - the component being validated Parameters: validationName - the name of the validation in the validation file Parameters: method - the method used to get the component's value if any the new and initialized XValidator |
addValidation | public XValidator addValidation(Component comp, String validationName)(Code) | | Adds a validation to this page. It is assumed that the validation will be
invoked in response to FocusEvent.FOCUS_LOST events
Parameters: comp - the component being validated Parameters: validationName - the name of the validation in the validation file the new and initialized XValidator |
checkValidations | public int checkValidations()(Code) | | Check all validations for this page. Typically this method should be
invoked prior to a page transition or a critical transaction.
the maximum error level raised by the validators |
clearValidations | public void clearValidations()(Code) | | Reset/removes all validations
|
getValidation | public XValidator getValidation(String validationName, String method, int mask)(Code) | | Adds a validation to this page.
Parameters: comp - the component being validated Parameters: validationName - the name of the validation in the validation file Parameters: mask - the event mask used to filter the events that trigger the validation the new and initialized XValidator |
getValidation | public XValidator getValidation(String validationName, String method)(Code) | | Gets a XValidator object. The parameters of the object are read from the
validation file
Parameters: validationName - the name of the validation in the validation file Parameters: method - the method used to get the component's value if any the new and initialized XValidator |
getValidations | public Vector getValidations(Component comp)(Code) | | Gets all the validations installed for a component
Parameters: comp - the target component a Vector of XValidators |
handleException | public boolean handleException(Component comp, Exception ex, XValidator validator)(Code) | | A method called when a validation exeption has been trapped.
Parameters: c - Component being validated Parameters: ex - The exception caused Parameters: validator - The validator being used to validate. true to continue with error validation or false to suppress furthervalidation. |
setEventHandler | public void setEventHandler(XEventHandler eh)(Code) | | Set the event handler instance. This class needs to interact with the event
handler to manage focus and to gain access to the current event
Parameters: eh - the event handler |
setExceptionHandler | public void setExceptionHandler(XValidationExceptionHandler eh)(Code) | | Set the validation exception handler called when a validation exception is trapped
Parameters: eh - |
setValidationFactory | public void setValidationFactory(XValidationFactory vf)(Code) | | Sets the factory used to create XValidator objects
Parameters: vf - |
validationHandler | public int validationHandler()(Code) | | Invoke the validators for the last event. Multiple validations are checked
in the order in which they were added.
the maximum level returned by the validators |
|
|