com.sencha.gxt.widget.core.client.form.validator
Class RegExValidator

java.lang.Object
  extended by com.sencha.gxt.widget.core.client.form.validator.AbstractValidator<String>
      extended by com.sencha.gxt.widget.core.client.form.validator.RegExValidator
All Implemented Interfaces:
Validator<String>

public class RegExValidator
extends AbstractValidator<String>

Validates the target value using a regular expression.


Nested Class Summary
static interface RegExValidator.RegExMessages
           
 
Constructor Summary
RegExValidator(String regex)
          Creates a new regex validator.
RegExValidator(String regex, String message)
          Creates a new regex validator.
 
Method Summary
 RegExValidator.RegExMessages getMessages()
          Returns the messages.
 String getRegex()
          Returns the regular expression.
 void setMessages(RegExValidator.RegExMessages messages)
          Sets the messages.
 void setRegex(String regex)
          Sets the regular expression.
 List<EditorError> validate(Editor<String> field, String value)
          Validates the value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegExValidator

public RegExValidator(String regex)
Creates a new regex validator.

Parameters:
regex - the regular expression

RegExValidator

public RegExValidator(String regex,
                      String message)
Creates a new regex validator.

Parameters:
regex - the regular expression
message - the error message
Method Detail

getMessages

public RegExValidator.RegExMessages getMessages()
Returns the messages.

Returns:
the messages

getRegex

public String getRegex()
Returns the regular expression.

Returns:
the regular expression

setMessages

public void setMessages(RegExValidator.RegExMessages messages)
Sets the messages.

Parameters:
messages - the messages

setRegex

public void setRegex(String regex)
Sets the regular expression.

Parameters:
regex - the regular expression

validate

public List<EditorError> validate(Editor<String> field,
                                  String value)
Description copied from interface: Validator
Validates the value.

Parameters:
field - the editor
value - the value
Returns:
the errors if any, otherwise, empty list or null


Copyright © 2012. All Rights Reserved.