@Override
@SuppressWarnings("deprecation")
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+
+ String oldLocale = getWidget().getCurrentLocale();
+
boolean lastReadOnlyState = getWidget().isReadonly();
boolean lastEnabledState = getWidget().isEnabled();
getWidget().calendar.renderCalendar();
}
}
+
+ // Force re-render of calendar if locale has changed (#12153)
+ if (getWidget().getCurrentLocale() != oldLocale) {
+ getWidget().calendar.renderCalendar();
+ }
+
getWidget().calendarToggle.setEnabled(getWidget().isEnabled());
if (getWidget().getCurrentResolution().getCalendarField() <= Resolution.MONTH
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.datefield.PopupDateFieldLocaleTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldLocaleTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]/domChild[1]</td>
+ <td>15,18</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[4]/span</td>
+ <td>19,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldLocaleTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]/domChild[1]</td>
+ <td>4,14</td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td></td>
+ <td>janvier 2000</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--- /dev/null
+package com.vaadin.tests.components.datefield;
+
+import java.util.Calendar;
+import java.util.Locale;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.PopupDateField;
+
+public class PopupDateFieldLocaleTest extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ // Set a specific time for the PopupDateField
+ Calendar cal = Calendar.getInstance();
+ cal.set(Calendar.YEAR, 2000);
+ cal.set(Calendar.DAY_OF_YEAR, 1);
+ cal.set(Calendar.HOUR_OF_DAY, 1);
+ cal.set(Calendar.MINUTE, 1);
+ cal.set(Calendar.SECOND, 1);
+ cal.set(Calendar.MILLISECOND, 1);
+
+ final PopupDateField pdf = new PopupDateField();
+ pdf.setLocale(Locale.ENGLISH);
+ pdf.setValue(cal.getTime());
+ pdf.setImmediate(true);
+ pdf.setResolution(DateField.RESOLUTION_SEC);
+ addComponent(pdf);
+
+ pdf.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ pdf.setLocale(Locale.FRENCH);
+ }
+ });
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Changing the locale while the popupdatefield is visible can "
+ + "result in the locale remaining at the previous value; the locale "
+ + "is only changed once the current month is changed.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12135;
+ }
+
+}
\ No newline at end of file