com.gridsystems.config.tools
Class NumberVerifier

java.lang.Object
  extended by javax.swing.InputVerifier
      extended by com.gridsystems.config.tools.TextVerifier
          extended by com.gridsystems.config.tools.NumberVerifier
Direct Known Subclasses:
PortVerifier

public class NumberVerifier
extends TextVerifier

Ensures a value is a valid integer between two limits.

Version:
1.0
Author:
Rodrigo Ruiz Aguayo

Field Summary
protected  java.lang.String id
          Error identifier.
static java.lang.String ID_EMPTY
          Error detected by this verifier.
static java.lang.String ID_INVALID
          Error detected by this verifier.
static java.lang.String ID_OUTOFRANGE
          Error detected by this verifier.
 
Fields inherited from class com.gridsystems.config.tools.TextVerifier
support
 
Constructor Summary
NumberVerifier(ErrorSupport support, java.lang.String id)
          Creates a new instance with no bounds, and not empty values allowed.
NumberVerifier(ErrorSupport support, java.lang.String id, boolean emptyAllowed)
          Creates a new instance with no bounds.
NumberVerifier(ErrorSupport support, java.lang.String id, int min, int max, boolean emptyAllowed)
          Creates a new instance.
 
Method Summary
 void cleanErrors()
          Removes from the error support manager the list of errors of this verifier.
 boolean verify(java.lang.String text)
          Performs the validation of the specified text.
 
Methods inherited from class com.gridsystems.config.tools.TextVerifier
updateError, verify
 
Methods inherited from class javax.swing.InputVerifier
shouldYieldFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_EMPTY

public static final java.lang.String ID_EMPTY
Error detected by this verifier.

See Also:
Constant Field Values

ID_OUTOFRANGE

public static final java.lang.String ID_OUTOFRANGE
Error detected by this verifier.

See Also:
Constant Field Values

ID_INVALID

public static final java.lang.String ID_INVALID
Error detected by this verifier.

See Also:
Constant Field Values

id

protected java.lang.String id
Error identifier.

Constructor Detail

NumberVerifier

public NumberVerifier(ErrorSupport support,
                      java.lang.String id)
Creates a new instance with no bounds, and not empty values allowed.

Parameters:
support - The ErrorSupport instance
id - The error identifier

NumberVerifier

public NumberVerifier(ErrorSupport support,
                      java.lang.String id,
                      boolean emptyAllowed)
Creates a new instance with no bounds.

Parameters:
support - The ErrorSupport instance
id - The error identifier
emptyAllowed - Whether to allow empty values or not

NumberVerifier

public NumberVerifier(ErrorSupport support,
                      java.lang.String id,
                      int min,
                      int max,
                      boolean emptyAllowed)
Creates a new instance.

Parameters:
support - The ErrorSupport instance
id - The error identifier
min - Minimum valid value
max - Maximum valid value
emptyAllowed - Whether to allow empty values or not
Method Detail

verify

public boolean verify(java.lang.String text)
Performs the validation of the specified text.

Specified by:
verify in class TextVerifier
Parameters:
text - The text to verify
Returns:
true if the text is valid, false otherwise

cleanErrors

public void cleanErrors()
Description copied from class: TextVerifier
Removes from the error support manager the list of errors of this verifier.

This method will be used on field deactivation.

Specified by:
cleanErrors in class TextVerifier
See Also:
TextVerifier.cleanErrors()


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.