|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.seam.ui.validator.FormattedTextValidator
public class FormattedTextValidator
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.
Uses an instance of SeamTextParser by default, override if you require validation with your customized instance of SeamTextParser.
| Field Summary |
|---|
| Fields inherited from interface javax.faces.validator.Validator |
|---|
NOT_IN_RANGE_MESSAGE_ID |
| Constructor Summary | |
|---|---|
FormattedTextValidator()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
getErrorLocation(java.lang.String originalText,
antlr.RecognitionException re,
int charsBefore,
int charsAfter)
Extracts the error from the RecognitionException and generates a location of the error by extracting the original text at the exceptions line and column. |
static java.lang.String |
getErrorMessage(java.lang.String originalText,
antlr.RecognitionException re)
Extracts the error from the RecognitionException and generates a message including the location of the error. |
java.lang.String |
getMismatchedTokenErrorMessage(java.lang.String originalMessage,
java.lang.String location)
Override (e.g. |
java.lang.String |
getNoViableAltErrorMessage(java.lang.String originalMessage,
java.lang.String location)
Override (e.g. |
int |
getNumberOfCharsAfterErrorLocation()
|
int |
getNumberOfCharsBeforeErrorLocation()
|
java.lang.String |
getParserErrorMessage(java.lang.String originalText,
antlr.RecognitionException re)
|
org.jboss.seam.text.SeamTextParser |
getSeamTextParser(java.lang.String text)
Override to instantiate a custom SeamTextLexer and SeamTextParser. |
java.lang.String |
getSemanticErrorMessage(java.lang.String originalMessage)
Override (e.g. |
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 |
| Constructor Detail |
|---|
public FormattedTextValidator()
| Method Detail |
|---|
public void validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
throws javax.faces.validator.ValidatorException
validate in interface javax.faces.validator.Validatorjavax.faces.validator.ValidatorExceptionpublic org.jboss.seam.text.SeamTextParser getSeamTextParser(java.lang.String text)
text - the raw markup text
public java.lang.String getParserErrorMessage(java.lang.String originalText,
antlr.RecognitionException re)
public int getNumberOfCharsBeforeErrorLocation()
public int getNumberOfCharsAfterErrorLocation()
public java.lang.String getNoViableAltErrorMessage(java.lang.String originalMessage,
java.lang.String location)
originalMessage - the ANTLR parser error message of the RecognitionExceptionlocation - a snippet that indicates the location in the original markup, might be null
public java.lang.String getMismatchedTokenErrorMessage(java.lang.String originalMessage,
java.lang.String location)
originalMessage - the ANTLR parser error message of the RecognitionExceptionlocation - a snippet that indicates the location in the original markup, might be null
public java.lang.String getSemanticErrorMessage(java.lang.String originalMessage)
originalMessage - the ANTLR parser error message of the RecognitionException
public static java.lang.String getErrorLocation(java.lang.String originalText,
antlr.RecognitionException re,
int charsBefore,
int charsAfter)
originalText - the original Seam Text markup as fed into the parserre - an ANTLR RecognitionException thrown by the parsercharsBefore - characters before error location included in messagecharsAfter - characters after error location included in message
public static java.lang.String getErrorMessage(java.lang.String originalText,
antlr.RecognitionException re)
originalText - the original Seam Text markup as fed into the parserre - an ANTLR RecognitionException thrown by the parser
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||