org.jboss.seam.ui.validator
Class FormattedTextValidator
java.lang.Object
org.jboss.seam.ui.validator.FormattedTextValidator
- All Implemented Interfaces:
- java.io.Serializable, java.util.EventListener, javax.faces.validator.Validator
public class FormattedTextValidator
- extends java.lang.Object
- implements javax.faces.validator.Validator, java.io.Serializable
Formatted Text validator
Use as a JSF validator on an input control that allows entering Seam Text
markup.
The Seam Text parser has a disabled default error handler, catch exceptions
as appropriate if you display Seam Text (see http://www.doc.ic.ac.uk/lab/secondyear/Antlr/err.html)
and call the static convenience method
FormattedTextValidator.getErrorMessage(originalText, recognitionException)
if you want to display or log a nice error message.
- Author:
- matthew.drees, Christian Bauer
- See Also:
- Serialized Form
Fields inherited from interface javax.faces.validator.Validator |
NOT_IN_RANGE_MESSAGE_ID |
Method Summary |
static java.lang.String |
getErrorMessage(java.lang.String originalText,
antlr.RecognitionException re)
Extracts the error from the RecognitionException and generates
a message with some helpful context. |
void |
validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
Validate the given value as well-formed Seam Text. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FormattedTextValidator
public FormattedTextValidator()
validate
public void validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
throws javax.faces.validator.ValidatorException
- Validate the given value as well-formed Seam Text. If there are parse
errors, throw a ValidatorException including the first parse error.
- Specified by:
validate
in interface javax.faces.validator.Validator
- Throws:
javax.faces.validator.ValidatorException
getErrorMessage
public static java.lang.String getErrorMessage(java.lang.String originalText,
antlr.RecognitionException re)
- Extracts the error from the RecognitionException and generates
a message with some helpful context.
- Parameters:
originalText
- the original Seam Text markup as fed into the parserre
- an ANTLR RecognitionException thrown by the parser
- Returns:
- an error message with some helpful context about where the error
occured
Copyright © 2008. All Rights Reserved.