net.xoetrope.xui.validation
Class XMandatoryValidator

java.lang.Object
  extended by net.xoetrope.xui.validation.XBaseValidator
      extended by net.xoetrope.xui.validation.XMandatoryValidator
All Implemented Interfaces:
XValidator

public class XMandatoryValidator
extends XBaseValidator

Implements a validator that must succeed for event handling to continue

Copyright: Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt


Field Summary
 
Fields inherited from class net.xoetrope.xui.validation.XBaseValidator
container, errorLevel, formattedMessage, mandatory, mask, message, start, validationMethod, validationName, value
 
Fields inherited from interface net.xoetrope.xui.validation.XValidator
IGNORE_BLANKS, LEVEL_ERROR, LEVEL_IGNORE, LEVEL_WARNING, MANDATORY, STRICT_CHECK, WEAK_CHECK
 
Constructor Summary
XMandatoryValidator(java.lang.String name, int mask)
          Applied to components when input is simply mandatory
 
Method Summary
 void setup(XmlElement element)
          Set the validation parameters
 void validate(java.lang.Object c, boolean forceMandatory)
          Carries out the mandatory validation on the component.
 
Methods inherited from class net.xoetrope.xui.validation.XBaseValidator
getLevel, getMask, getMessage, getName, getText, getValueAsString, invokeMethod, replaceToken, replaceTokens, setMask, setName, setValidationMethod, throwException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMandatoryValidator

public XMandatoryValidator(java.lang.String name,
                           int mask)
Applied to components when input is simply mandatory

Parameters:
name - The name of the validation
mask - The mask for inline validations
Method Detail

setup

public void setup(XmlElement element)
Set the validation parameters

Overrides:
setup in class XBaseValidator
Parameters:
element - the validator parameters

validate

public void validate(java.lang.Object c,
                     boolean forceMandatory)
              throws java.lang.Exception
Carries out the mandatory validation on the component. If the Method validationMethod is not null we have to invoke it in order to get it's return value. If a problem is found we format the message using the messageHelper.

Parameters:
forceMandatory - true when inline validations are carried out
c - The component triggering the validation
Throws:
java.lang.Exception - Contains the details of the message