use of io.jmix.core.Messages in project jmix by jmix-framework.
the class DateFieldImpl method handleDateOutOfRange.
protected void handleDateOutOfRange(V value) {
if (getFrame() != null) {
Messages messages = applicationContext.getBean(Messages.class);
Notifications notifications = ComponentsHelper.getScreenContext(this).getNotifications();
notifications.create().withCaption(messages.getMessage("datePicker.dateOutOfRangeMessage")).withType(Notifications.NotificationType.TRAY).show();
}
setValueToPresentation(convertToLocalDateTime(value, zoneId));
}
use of io.jmix.core.Messages in project jmix by jmix-framework.
the class CalendarImpl method initComponent.
protected void initComponent(JmixCalendar component) {
Messages messages = applicationContext.getBean(Messages.class);
String[] monthNamesShort = new String[12];
monthNamesShort[0] = messages.getMessage("calendar.januaryCaption");
monthNamesShort[1] = messages.getMessage("calendar.februaryCaption");
monthNamesShort[2] = messages.getMessage("calendar.marchCaption");
monthNamesShort[3] = messages.getMessage("calendar.aprilCaption");
monthNamesShort[4] = messages.getMessage("calendar.mayCaption");
monthNamesShort[5] = messages.getMessage("calendar.juneCaption");
monthNamesShort[6] = messages.getMessage("calendar.julyCaption");
monthNamesShort[7] = messages.getMessage("calendar.augustCaption");
monthNamesShort[8] = messages.getMessage("calendar.septemberCaption");
monthNamesShort[9] = messages.getMessage("calendar.octoberCaption");
monthNamesShort[10] = messages.getMessage("calendar.novemberCaption");
monthNamesShort[11] = messages.getMessage("calendar.decemberCaption");
component.setMonthNamesShort(monthNamesShort);
String[] dayNamesShort = new String[7];
dayNamesShort[0] = messages.getMessage("calendar.sundayCaption");
dayNamesShort[1] = messages.getMessage("calendar.mondayCaption");
dayNamesShort[2] = messages.getMessage("calendar.tuesdayCaption");
dayNamesShort[3] = messages.getMessage("calendar.wednesdayCaption");
dayNamesShort[4] = messages.getMessage("calendar.thursdayCaption");
dayNamesShort[5] = messages.getMessage("calendar.fridayCaption");
dayNamesShort[6] = messages.getMessage("calendar.saturdayCaption");
component.setDayNamesShort(dayNamesShort);
if (TIME_FORMAT_12H.equals(messages.getMessage("calendar.timeFormat"))) {
setTimeFormat(TimeFormat.FORMAT_12H);
} else if (TIME_FORMAT_24H.equals(messages.getMessage("calendar.timeFormat"))) {
setTimeFormat(TimeFormat.FORMAT_24H);
} else {
throw new IllegalStateException(String.format("Can't set time format '%s'", messages.getMessage("calendar.timeFormat")));
}
CurrentAuthentication currentAuthentication = applicationContext.getBean(CurrentAuthentication.class);
TimeZone userTimeZone = currentAuthentication.getTimeZone();
setTimeZone(userTimeZone);
setNavigationButtonsStyle(navigationButtonsVisible);
}
use of io.jmix.core.Messages in project jmix by jmix-framework.
the class AbstractField method getDefaultRequiredMessage.
protected String getDefaultRequiredMessage() {
Messages messages = applicationContext.getBean(Messages.class);
String caption = getCaption();
return Strings.isNullOrEmpty(caption) ? messages.getMessage("validationFail.defaultRequiredMessage") : messages.formatMessage("", "validationFail.defaultDetailedRequiredMessage", caption);
}
Aggregations