/** * Set the format of the Date shown in the TextBox component. * This is converted to BS3's Date Format that the underlying jQuery-based BS3 DatePicker * uses to convert values in the TextBox to selections in the popup date picker element. * @param gwtDateFormat */ public void setFormat(final String gwtDateFormat) { this.gwtDateFormat = gwtDateFormat; this.gwtDateTimeFormat = DateTimeFormat.getFormat(this.gwtDateFormat); if (getLocaleName().equals("")) { datePicker.setLanguage(DatePickerLanguage.EN); } else { datePicker.setLanguage(DatePickerLanguage.valueOf(getLocaleName().toUpperCase())); } datePicker.setFormat(DatePickerFormatUtilities.convertToBS3DateFormat(gwtDateFormat)); }
/** * Set the format of the Date shown in the TextBox component. * This is converted to BS3's Date Format that the underlying jQuery-based BS3 DatePicker * uses to convert values in the TextBox to selections in the popup date picker element. * @param gwtDateFormat */ public void setFormat(final String gwtDateFormat) { this.gwtDateFormat = gwtDateFormat; this.gwtDateTimeFormat = DateTimeFormat.getFormat(this.gwtDateFormat); if (getLocaleName().equals("")) { datePicker.setLanguage(DatePickerLanguage.EN); } else { datePicker.setLanguage(DatePickerLanguage.valueOf(getLocaleName().toUpperCase())); } datePicker.setFormat(DatePickerFormatUtilities.convertToBS3DateFormat(gwtDateFormat)); }
@Test public void testGetLocaleName() { datePicker = new DatePicker(datePickerMock); datePicker.setLocaleName(""); assertEquals("", datePicker.getLocaleName()); datePicker.setLocaleName(null); assertEquals("", datePicker.getLocaleName()); datePicker.setLocaleName("default"); assertEquals("", datePicker.getLocaleName()); String currentLocale = "testValue"; datePicker.setLocaleName(currentLocale); assertEquals(currentLocale, datePicker.getLocaleName()); }