Search in sources :

Example 1 with Messages

use of io.jmix.core.Messages in project jmix by jmix-framework.

the class ShowLinkAction method actionPerform.

@Override
public void actionPerform(io.jmix.ui.component.Component component) {
    if (ds == null) {
        return;
    }
    Messages messages = AppBeans.get(Messages.class);
    Dialogs dialogs = AppUI.getCurrent().getDialogs();
    dialogs.createMessageDialog().withCaption(messages.getMessage("table.showLinkAction")).withMessage(compileLink(ds)).show();
}
Also used : Messages(io.jmix.core.Messages) Dialogs(io.jmix.ui.Dialogs)

Example 2 with Messages

use of io.jmix.core.Messages in project jmix by jmix-framework.

the class WebSearchPickerField method initComponent.

@Override
protected void initComponent(JmixPickerField<V> component) {
    Messages messages = applicationContext.getBean(Messages.class);
    setInputPrompt(messages.getMessage("searchPickerField.inputPrompt"));
    getComponent().setItemCaptionGenerator(this::generateItemCaption);
    getComponent().setFilterHandler(this::executeSearch);
}
Also used : Messages(io.jmix.core.Messages)

Example 3 with Messages

use of io.jmix.core.Messages in project jmix by jmix-framework.

the class WebSearchPickerField method createSearchNotifications.

protected SearchNotifications createSearchNotifications() {
    return new SearchNotifications() {

        @Override
        public void notFoundSuggestions(String filterString) {
            Messages messages = applicationContext.getBean(Messages.class);
            String message = messages.formatMessage("", "searchSelect.notFound", filterString);
        // TODO: legacy-ui
        // App.getInstance().getWindowManager().showNotification(message, defaultNotificationType);
        }

        @Override
        public void needMinSearchStringLength(String filterString, int minSearchStringLength) {
            Messages messages = applicationContext.getBean(Messages.class);
            String message = messages.formatMessage("", "searchSelect.minimumLengthOfFilter", minSearchStringLength);
        // TODO: legacy-ui
        // App.getInstance().getWindowManager().showNotification(message, defaultNotificationType);
        }
    };
}
Also used : Messages(io.jmix.core.Messages)

Example 4 with Messages

use of io.jmix.core.Messages in project jmix by jmix-framework.

the class RoleAssignmentScreen method initScreenActions.

protected void initScreenActions() {
    Window window = getWindow();
    Messages messages = getApplicationContext().getBean(Messages.class);
    Icons icons = getApplicationContext().getBean(Icons.class);
    String commitShortcut = getApplicationContext().getBean(UiScreenProperties.class).getCommitShortcut();
    Action commitAndCloseAction = new BaseAction(Window.COMMIT_ACTION_ID).withCaption(messages.getMessage("actions.Ok")).withIcon(icons.get(JmixIcon.EDITOR_OK)).withPrimary(true).withShortcut(commitShortcut).withHandler(actionPerformedEvent -> {
        // noinspection ConstantConditions
        getScreenData().getDataContext().commit();
        close(new StandardCloseAction(Window.COMMIT_ACTION_ID));
    });
    window.addAction(commitAndCloseAction);
    Action closeAction = new BaseAction(Window.CLOSE_ACTION_ID).withIcon(icons.get(JmixIcon.EDITOR_CANCEL)).withCaption(messages.getMessage("actions.Cancel")).withHandler(actionPerformedEvent -> {
        if (dataContext.hasChanges()) {
            screenValidation.showUnsavedChangesDialog(this, WINDOW_CLOSE_ACTION).onDiscard(() -> close(WINDOW_CLOSE_ACTION));
        } else {
            close(WINDOW_CLOSE_ACTION);
        }
    });
    window.addAction(closeAction);
}
Also used : Window(io.jmix.ui.component.Window) Action(io.jmix.ui.action.Action) BaseAction(io.jmix.ui.action.BaseAction) Messages(io.jmix.core.Messages) UiScreenProperties(io.jmix.ui.UiScreenProperties) Icons(io.jmix.ui.icon.Icons) BaseAction(io.jmix.ui.action.BaseAction)

Example 5 with Messages

use of io.jmix.core.Messages in project jmix by jmix-framework.

the class StandardLookup method initActions.

protected void initActions(@SuppressWarnings("unused") InitEvent event) {
    Messages messages = getApplicationContext().getBean(Messages.class);
    Icons icons = getApplicationContext().getBean(Icons.class);
    BaseAction selectAction = (BaseAction) getWindowActionOptional(LOOKUP_SELECT_ACTION_ID).orElseGet(() -> addDefaultSelectAction(messages, icons));
    selectAction.addActionPerformedListener(this::select);
    BaseAction cancelAction = (BaseAction) getWindowActionOptional(LOOKUP_CANCEL_ACTION_ID).orElseGet(() -> addDefaultCancelAction(messages, icons));
    cancelAction.addActionPerformedListener(this::cancel);
}
Also used : Messages(io.jmix.core.Messages) Icons(io.jmix.ui.icon.Icons) BaseAction(io.jmix.ui.action.BaseAction)

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