net.xoetrope.xui.validation
Class XMinMaxValidator

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

public class XMinMaxValidator
extends XBaseValidator

Performs a min/max check, reading the minimum and maximum values from the configuration file

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

$Revision: 2.6 $


Field Summary
protected  float max
           
protected  float min
           
 
Fields inherited from class net.xoetrope.xui.validation.XBaseValidator
container, currentProject, errorLevel, formattedMessage, mandatory, mask, message, start, USE_FAIL_STYLE, USE_NORMAL_STYLE, USE_WARN_STYLE, 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
XMinMaxValidator(XProject project)
          Constructors the XMinMaxValidator
 
Method Summary
 float getMax()
          Retrieve the maximun value assigned to this validation
 float getMin()
          Retrieve the minimum value assigned to this validation
protected  float getValue(java.lang.String in)
          Used to get converted unit values when working with subclasses
 void setMax(float f)
          Set the maximum value being validated against
 void setMin(float f)
          Set the minimum value being validated against
 void setup(XmlElement element)
          Set the validation parameters
 void validate(java.lang.Object c, boolean forceMandatory)
          Carries out the min-max validation on the fValue entered.
 
Methods inherited from class net.xoetrope.xui.validation.XBaseValidator
applyErrorStyle, getLevel, getMask, getMessage, getName, getText, getValueAsString, invokeMethod, replaceToken, replaceTokens, setMask, setName, setValidationColors, setValidationMethod, throwException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

min

protected float min

max

protected float max
Constructor Detail

XMinMaxValidator

public XMinMaxValidator(XProject project)
Constructors the XMinMaxValidator

Parameters:
project - the owner project
Method Detail

setup

public void setup(XmlElement element)
Set the validation parameters

Specified by:
setup in interface XValidator
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 min-max validation on the fValue entered. If the Method validationMethod is not null we have to invoke it in order to get it's return fValue. If the Method invocation returns a null we do not validate. If a problem is found we format the message using the messageHelper.

Parameters:
forceMandatory - Indicates that its a page validation and not an inline validation so mandatory entries should be checked
c - The component triggering the validation
Throws:
java.lang.Exception - Contains the details of the message

getValue

protected float getValue(java.lang.String in)
Used to get converted unit values when working with subclasses

Parameters:
in - the value being compared
Returns:
the converted value

getMin

public float getMin()
Retrieve the minimum value assigned to this validation

Returns:
The minimum value being validated against

getMax

public float getMax()
Retrieve the maximun value assigned to this validation

Returns:
The maximum value being validated against

setMin

public void setMin(float f)
Set the minimum value being validated against

Parameters:
f - The minimum value to be set

setMax

public void setMax(float f)
Set the maximum value being validated against

Parameters:
f - The maximum value to be set