Example usage for org.apache.wicket.util.convert ConversionException getFormat

List of usage examples for org.apache.wicket.util.convert ConversionException getFormat

Introduction

In this page you can find the example usage for org.apache.wicket.util.convert ConversionException getFormat.

Prototype

public final Format getFormat() 

Source Link

Document

Get the used format.

Usage

From source file:org.wicketstuff.multitextinput.MultiTextInput.java

License:Apache License

/**
 * Robbed from {@link FormComponent}/*ww w  .ja va 2s .  com*/
 * 
 * @param e
 * @param error
 */
private void reportValidationError(ConversionException e, ValidationError error) {
    final Locale locale = e.getLocale();
    if (locale != null) {
        error.setVariable("locale", locale);
    }
    error.setVariable("exception", e);
    Format format = e.getFormat();
    if (format instanceof SimpleDateFormat) {
        error.setVariable("format", ((SimpleDateFormat) format).toLocalizedPattern());
    }

    Map<String, Object> variables = e.getVariables();
    if (variables != null) {
        error.getVariables().putAll(variables);
    }

    error(error);
}