chrriis.dj.swingsuite
Class TextEntryValidator

java.lang.Object
  extended by chrriis.dj.swingsuite.TextEntryValidator

public abstract class TextEntryValidator
extends Object

Author:
Christopher Deckers

Constructor Summary
TextEntryValidator()
           
 
Method Summary
 String getDefaultValidText(JTextEntryField textEntryField)
          Get a default text that is valid within the current set of validation constraints.
 String getInvalidTextErrorMessage(JTextEntryField textEntryField, String invalidText)
          Get the message to show when the current text is invalid, or null for the default.
 boolean isTextAllowed(JTextEntryField textEntryField, String text)
          Indicate whether the text is allowed.
 boolean isTextValid(JTextEntryField textEntryField, String text)
          Indicate whether the text is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextEntryValidator

public TextEntryValidator()
Method Detail

isTextAllowed

public boolean isTextAllowed(JTextEntryField textEntryField,
                             String text)
Indicate whether the text is allowed.

Parameters:
textEntryField - The text entry field for which to test the value.
Returns:
true if the text is allowed, false otherwise.

isTextValid

public boolean isTextValid(JTextEntryField textEntryField,
                           String text)
Indicate whether the text is valid.

Parameters:
textEntryField - The text entry field for which to test the value.
Returns:
true if the text is valid, false otherwise.

getInvalidTextErrorMessage

public String getInvalidTextErrorMessage(JTextEntryField textEntryField,
                                         String invalidText)
Get the message to show when the current text is invalid, or null for the default.

Parameters:
textEntryField - The text entry field for which to test the value.
invalidText - the text which is invalid.
Returns:
the message.

getDefaultValidText

public String getDefaultValidText(JTextEntryField textEntryField)
Get a default text that is valid within the current set of validation constraints.
This method is invoked by the validation mechanism so it needs to be properly implemented..

Parameters:
textEntryField - The text entry field for which to test the value.
Returns:
A valid default text.