}
@Override
protected void setup(VaadinRequest request) {
final NativeSelect localeSelect = new NativeSelect("UI locale");
localeSelect.setImmediate(true);
localeSelect.addItem(new Locale("en", "US"));
localeSelect.addItem(new Locale("fi", "FI"));
localeSelect.addItem(Locale.GERMANY);
localeSelect.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
setLocale((Locale) localeSelect.getValue());
getSession().getService().setSystemMessagesProvider(
new SystemMessagesProvider() {
@Override
public SystemMessages getSystemMessages(
SystemMessagesInfo systemMessagesInfo) {
CustomizedSystemMessages csm = new CustomizedSystemMessages();
// csm.setInternalErrorCaption("Request query string: "
// + ((VaadinServletRequest) systemMessagesInfo
// .getRequest()).getQueryString());
csm.setInternalErrorMessage("MessagesInfo locale: "
+ systemMessagesInfo.getLocale());
return csm;
}
});
}
});
localeSelect.setValue(new Locale("fi", "FI"));
addComponent(localeSelect);
final MyButton failButton = new MyButton();
failButton.setCaption("Generate server side error");
failButton.addClickListener(new ClickListener() {