use of io.jmix.ui.icon.Icons in project jmix by jmix-framework.
the class AbstractComponentLoader method getIconPath.
@Nullable
protected String getIconPath(@Nullable String icon) {
if (icon == null || icon.isEmpty()) {
return null;
}
String iconPath = null;
if (ICON_NAME_REGEX.matcher(icon).matches()) {
Icons icons = applicationContext.getBean(Icons.class);
iconPath = icons.get(icon);
}
if (StringUtils.isEmpty(iconPath)) {
String themeValue = loadThemeString(icon);
iconPath = loadResourceString(themeValue);
}
return iconPath;
}
use of io.jmix.ui.icon.Icons 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);
}
use of io.jmix.ui.icon.Icons in project jmix by jmix-framework.
the class StandardEditor method initActions.
protected void initActions(@SuppressWarnings("unused") InitEvent event) {
Messages messages = getApplicationContext().getBean(Messages.class);
Icons icons = getApplicationContext().getBean(Icons.class);
BaseAction commitAndCloseAction = (BaseAction) getWindowActionOptional(WINDOW_COMMIT_AND_CLOSE).orElseGet(() -> addDefaultCommitAndCloseAction(messages, icons));
commitAndCloseAction.addActionPerformedListener(this::commitAndClose);
BaseAction commitAction = (BaseAction) getWindowActionOptional(WINDOW_COMMIT).orElseGet(() -> addDefaultCommitAction(messages, icons));
commitAction.addActionPerformedListener(this::commit);
BaseAction closeAction = (BaseAction) getWindowActionOptional(WINDOW_CLOSE).orElseGet(() -> addDefaultCloseAction(messages, icons));
closeAction.addActionPerformedListener(this::cancel);
BaseAction enableEditingAction = (BaseAction) getWindowActionOptional(ENABLE_EDITING).orElseGet(() -> addDefaultEnableEditingAction(messages, icons));
enableEditingAction.addActionPerformedListener(this::enableEditing);
}
use of io.jmix.ui.icon.Icons 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);
}
use of io.jmix.ui.icon.Icons in project jmix by jmix-framework.
the class ScriptEditorDialog method initAction.
protected void initAction() {
Icons icons = getApplicationContext().getBean(Icons.class);
UiScreenProperties screenProperties = getApplicationContext().getBean(UiScreenProperties.class);
Action commitAction = new BaseAction("commit").withCaption(messages.getMessage("actions.Ok")).withIcon(icons.get(JmixIcon.OK)).withPrimary(true).withShortcut(screenProperties.getCommitShortcut()).withHandler(this::commit);
getWindow().addAction(commitAction);
Action cancelAction = new BaseAction("cancel").withCaption(messages.getMessage("actions.Cancel")).withIcon(icons.get(JmixIcon.CANCEL)).withShortcut(screenProperties.getCloseShortcut()).withHandler(this::cancel);
getWindow().addAction(cancelAction);
}
Aggregations