Search in sources :

Example 16 with Messages

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));
}
Also used : Messages(io.jmix.core.Messages) Notifications(io.jmix.ui.Notifications)

Example 17 with Messages

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);
}
Also used : Messages(io.jmix.core.Messages) CurrentAuthentication(io.jmix.core.security.CurrentAuthentication)

Example 18 with Messages

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);
}
Also used : Messages(io.jmix.core.Messages)

Aggregations

Messages (io.jmix.core.Messages)18 BaseAction (io.jmix.ui.action.BaseAction)5 Icons (io.jmix.ui.icon.Icons)4 Action (io.jmix.ui.action.Action)3 Window (io.jmix.ui.component.Window)3 MetadataTools (io.jmix.core.MetadataTools)2 Notifications (io.jmix.ui.Notifications)2 UiScreenProperties (io.jmix.ui.UiScreenProperties)2 Collection (java.util.Collection)2 Security (com.haulmont.cuba.core.global.Security)1 Op (com.haulmont.cuba.core.global.filter.Op)1 OpManager (com.haulmont.cuba.core.global.filter.OpManager)1 WindowManager (com.haulmont.cuba.gui.WindowManager)1 OpenType (com.haulmont.cuba.gui.WindowManager.OpenType)1 Window (com.haulmont.cuba.gui.components.Window)1 ComponentsFactory (com.haulmont.cuba.gui.xml.layout.ComponentsFactory)1 CssLayout (com.vaadin.ui.CssLayout)1 Layout (com.vaadin.ui.Layout)1 MetaClass (io.jmix.core.metamodel.model.MetaClass)1 MetaPropertyPath (io.jmix.core.metamodel.model.MetaPropertyPath)1