@Override protected DateTimeFormatter getDateTimeFormatter(FormatStrings formatStrings, Locale locale) { return DateTimeFormatter.ofPattern(formatStrings.getTimeFormat(), locale); }
@Override protected DateTimeFormatter getDateTimeFormatter(FormatStrings formatStrings, Locale locale) { return DateTimeFormatter.ofPattern(formatStrings.getTimeFormat(), locale); }
@Override public Date parse(String value, Locale locale) throws ParseException { if (StringUtils.isBlank(value)) { return null; } FormatStrings formatStrings = AppBeans.get(FormatStringsRegistry.class).getFormatStrings(locale); if (formatStrings == null) { return parse(value); } DateFormat format = new SimpleDateFormat(formatStrings.getTimeFormat()); return format.parse(value.trim()); }
@Override public String format(Object value, Locale locale) { if (value == null) { return ""; } FormatStrings formatStrings = AppBeans.get(FormatStringsRegistry.class).getFormatStrings(locale); if (formatStrings == null) { return format(value); } DateFormat format = new SimpleDateFormat(formatStrings.getTimeFormat()); format.setLenient(false); return format.format(value); }
@Override public void afterPropertiesSet() { UserSessionSource userSessionSource = beanLocator.get(UserSessionSource.NAME); FormatStringsRegistry formatStringsRegistry = beanLocator.get(FormatStringsRegistry.NAME); String timeFormat = formatStringsRegistry.getFormatStringsNN(userSessionSource.getLocale()).getTimeFormat(); setFormat(timeFormat); }
@Override public void afterPropertiesSet() { UserSessionSource userSessionSource = beanLocator.get(UserSessionSource.class); Locale locale = userSessionSource.getLocale(); FormatStringsRegistry formatStringsRegistry = beanLocator.get(FormatStringsRegistry.NAME); dateField.setDateFormat(formatStringsRegistry.getFormatStringsNN(locale).getDateFormat()); dateField.setResolution(DateResolution.DAY); timeField.setTimeFormat(formatStringsRegistry.getFormatStringsNN(locale).getTimeFormat()); setResolution(Resolution.MIN); AppUI ui = AppUI.getCurrent(); if (ui != null && ui.isTestMode()) { timeField.setCubaId("timepart"); dateField.setCubaId("datepart"); } }