org.apache.tapestry.valid
Class AbstractNumericValidator

java.lang.Object
  extended by org.apache.tapestry.valid.BaseValidator
      extended by org.apache.tapestry.valid.AbstractNumericValidator
All Implemented Interfaces:
IValidator
Direct Known Subclasses:
IntValidator, NumberValidator

public abstract class AbstractNumericValidator
extends BaseValidator

Base class for a number of implementations of IValidator, meant to replace the awkward NumberValidator.

Author:
Howard M. Lewis Ship

Field Summary
 
Fields inherited from class org.apache.tapestry.valid.BaseValidator
FIELD_SYMBOL, FORM_SYMBOL, FUNCTION_SYMBOL, VALIDATOR_SYMBOL
 
Constructor Summary
AbstractNumericValidator()
           
AbstractNumericValidator(boolean required)
           
AbstractNumericValidator(String initializer)
           
 
Method Summary
protected  String buildInvalidIntegerFormatMessage(IFormComponent field)
           
protected  String buildInvalidNumericFormatMessage(IFormComponent field)
           
protected  String buildNumberRangeMessage(IFormComponent field, Number mininum, Number maximum)
           
protected  String buildNumberTooLargeMessage(IFormComponent field, Number maximum)
           
protected  String buildNumberTooSmallMessage(IFormComponent field, Number minimum)
           
protected  String buildRangeMessage(IFormComponent field, Number minimum, Number maximum)
           
protected abstract  String getDefaultScriptPath()
           
 String getInvalidIntegerFormatMessage()
           
 String getInvalidNumericFormatMessage()
           
 String getNumberRangeMessage()
           
 String getNumberTooLargeMessage()
           
 String getNumberTooSmallMessage()
           
 String getScriptPath()
           
 boolean getZeroIsNull()
          If true, then when rendering, a zero is treated as a non-value, and null is returned.
 void setInvalidIntegerFormatMessage(String string)
          Overrides the invalid-int-format bundle key.
 void setInvalidNumericFormatMessage(String string)
          Overrides the invalid-numeric-format bundle key.
 void setNumberRangeMessage(String string)
          Overrides the number-range bundle key.
 void setNumberTooLargeMessage(String string)
          Overrides the number-too-large bundle key.
 void setNumberTooSmallMessage(String string)
          Overrides the number-too-small bundle key.
 void setScriptPath(String scriptPath)
          Allows a developer to use the existing validation logic with a different client-side script.
 void setZeroIsNull(boolean zeroIsNull)
           
 
Methods inherited from class org.apache.tapestry.valid.BaseValidator
buildRequiredMessage, checkRequired, formatString, formatString, formatString, getPattern, getRequiredMessage, isClientScriptingEnabled, isRequired, processValidatorScript, renderValidatorContribution, setClientScriptingEnabled, setRequired, setRequiredMessage, setScriptSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.valid.IValidator
toObject, toString
 

Constructor Detail

AbstractNumericValidator

public AbstractNumericValidator()

AbstractNumericValidator

public AbstractNumericValidator(String initializer)

AbstractNumericValidator

public AbstractNumericValidator(boolean required)
Method Detail

getZeroIsNull

public boolean getZeroIsNull()
If true, then when rendering, a zero is treated as a non-value, and null is returned. If false, the default, then zero is rendered as zero.


setZeroIsNull

public void setZeroIsNull(boolean zeroIsNull)

getScriptPath

public String getScriptPath()
Since:
2.2

setScriptPath

public void setScriptPath(String scriptPath)
Allows a developer to use the existing validation logic with a different client-side script. This is often sufficient to allow application-specific error presentation (perhaps by using DHTML to update the content of a <span> tag, or to use a more sophisticated pop-up window than window.alert()).

Since:
2.2

getInvalidNumericFormatMessage

public String getInvalidNumericFormatMessage()
Since:
3.0

getInvalidIntegerFormatMessage

public String getInvalidIntegerFormatMessage()
Since:
3.0

getNumberRangeMessage

public String getNumberRangeMessage()
Since:
3.0

getNumberTooLargeMessage

public String getNumberTooLargeMessage()
Since:
3.0

getNumberTooSmallMessage

public String getNumberTooSmallMessage()
Since:
3.0

setInvalidNumericFormatMessage

public void setInvalidNumericFormatMessage(String string)
Overrides the invalid-numeric-format bundle key. Parameter {0} is the display name of the field.

Since:
3.0

setInvalidIntegerFormatMessage

public void setInvalidIntegerFormatMessage(String string)
Overrides the invalid-int-format bundle key. Parameter {0} is the display name of the field.

Since:
3.0

setNumberRangeMessage

public void setNumberRangeMessage(String string)
Overrides the number-range bundle key. Parameter [0} is the display name of the field. Parameter {1} is the minimum value. Parameter {2} is the maximum value.

Since:
3.0

setNumberTooLargeMessage

public void setNumberTooLargeMessage(String string)
Overrides the number-too-large bundle key. Parameter {0} is the display name of the field. Parameter {1} is the maximum allowed value.

Since:
3.0

setNumberTooSmallMessage

public void setNumberTooSmallMessage(String string)
Overrides the number-too-small bundle key. Parameter {0} is the display name of the field. Parameter {1} is the minimum allowed value.

Since:
3.0

buildInvalidNumericFormatMessage

protected String buildInvalidNumericFormatMessage(IFormComponent field)
Since:
3.0

buildNumberTooSmallMessage

protected String buildNumberTooSmallMessage(IFormComponent field,
                                            Number minimum)

buildInvalidIntegerFormatMessage

protected String buildInvalidIntegerFormatMessage(IFormComponent field)
Since:
3.0

buildNumberTooLargeMessage

protected String buildNumberTooLargeMessage(IFormComponent field,
                                            Number maximum)
Since:
3.0

buildNumberRangeMessage

protected String buildNumberRangeMessage(IFormComponent field,
                                         Number mininum,
                                         Number maximum)

buildRangeMessage

protected String buildRangeMessage(IFormComponent field,
                                   Number minimum,
                                   Number maximum)

getDefaultScriptPath

protected abstract String getDefaultScriptPath()


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.