Example usage for org.apache.wicket.markup.html.form Form getLocalizer

List of usage examples for org.apache.wicket.markup.html.form Form getLocalizer

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form Form getLocalizer.

Prototype

public final Localizer getLocalizer() 

Source Link

Document

Convenience method to provide easy access to the localizer object within any component.

Usage

From source file:ca.travelagency.customer.CustomerDuplicateValidator.java

License:Apache License

@Override
public void validate(Form<?> form) {
    Customer customer = (Customer) form.getModelObject();
    Date date = dateOfBirth.getConvertedInput();
    customer.setDateOfBirth(date);/*w  w  w. j  a  v a2 s.c o  m*/
    boolean duplicated = customerService.duplicated(customer);
    if (duplicated) {
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put(LAST_NAME, customer.getLastName());
        parameters.put(FIRST_NAME, customer.getFirstName());
        parameters.put(PRIMARY_PHONE, customer.getPrimaryPhone());
        parameters.put(DATE_OF_BIRTH, DateUtils.formatDate(date));
        String error = form.getLocalizer().getString(KEY, form);
        form.error(error, parameters);
    }
}