org.brains2b.swingext.mask
Interface InputValidator

All Known Implementing Classes:
DateValidator, NumberValidator, TextValidator

public interface InputValidator

Interface for defining Validators that can be used by MaskedField for displaying output masks.

This is basically an extention to the InputVerifier class. Which provides ways to retrieve the information from a field without the display mask.

It also provides a way to get the error message if the verify message returns false.

Version:
0.11 [01-06-2006]
Author:
dennis@brains2b.nl
See Also:
InputVerifier

Method Summary
 java.lang.String getErrorMessage()
          retrieves the errormessage if verify returns false.
 java.lang.String getLocalizedMessage()
          retrieve the error message, localized to the default locale if verify returns false
 java.lang.String getString(java.lang.String txt)
          gets a String as representation of the value from a InputValidator Implementations might differ on what you need the value for.
 java.lang.String getString(java.lang.String txt, java.lang.Class c)
          gets a String as representation of the value from a InputValidator Implemenations differ for the implementations of this interface and on which Class is supplied for output.
 boolean verify(javax.swing.JComponent input)
          Just a reference to verify in javax.swing.InputVerifier
 

Method Detail

getErrorMessage

java.lang.String getErrorMessage()
retrieves the errormessage if verify returns false.

Returns:
String, the message describing the verify error, returns null if there was no error.

getLocalizedMessage

java.lang.String getLocalizedMessage()
retrieve the error message, localized to the default locale if verify returns false

Returns:
String, the message describing the error in the appropriate language The message will be returned in English if the appropriate language cannot be found. Returns null if there was no error.
Since:
Framework 0.32

getString

java.lang.String getString(java.lang.String txt)
gets a String as representation of the value from a InputValidator

Implementations might differ on what you need the value for.

If you can do with the value with the Mask just use the getText() on which ever field this InputValidator is implemented on.

Parameters:
txt - String, the Masked text of this Validator
Returns:
String, the 'transformed' String you want to retrieve

getString

java.lang.String getString(java.lang.String txt,
                           java.lang.Class c)
gets a String as representation of the value from a InputValidator

Implemenations differ for the implementations of this interface and on which Class is supplied for output. Also not all requested output Classes are implemented for every implementation. on which ever field this InputValidator is implemented on.

Parameters:
txt - String, the Masked text of this Validator
c - Class, the type of output you want to return as a String representation
Returns:
String, the 'transformed' String you want to retrieve

verify

boolean verify(javax.swing.JComponent input)
Just a reference to verify in javax.swing.InputVerifier

See Also:
InputVerifier