new BaseAction(WINDOW_COMMIT_AND_CLOSE) .withCaption(messages.getMainMessage("actions.OkClose")) .withPrimary(true) .withShortcut(commitShortcut) .withHandler(e -> commitAndClose())); .withPrimary(!commitAndCloseButtonExists) .withShortcut(commitAndCloseButtonExists ? null : commitShortcut) .withHandler(e -> {
@Override public void init(Map<String, Object> params) { super.init(params); getDialogOptions().setWidthAuto(); copyBtn.setAction(new BaseAction("deployBtn") .withPrimary(true) .withHandler(e -> { if (usersDs.getItem() == null) { showNotification( getMessage("selectUser"), NotificationType.HUMANIZED); } else { showOptionDialog( getMessage("confirmCopy.title"), getMessage("confirmCopy.msg"), MessageType.CONFIRMATION, new Action[]{ new DialogAction(Type.YES).withHandler(event -> copySettings()), new DialogAction(Type.NO, Action.Status.PRIMARY) } ); } })); cancelBtn.setAction(new AbstractAction("cancelBtn") { @Override public void actionPerform(Component component) { close("cancel"); } }); }
.withCaption(messages.getMainMessage("actions.Ok")) .withShortcut(clientConfig.getCommitShortcut()) .withPrimary(true) .withHandler(event -> commit()
protected void initActions(@SuppressWarnings("unused") InitEvent event) { Window window = getWindow(); Configuration configuration = getBeanLocator().get(Configuration.NAME); Messages messages = getBeanLocator().get(Messages.NAME); Icons icons = getBeanLocator().get(Icons.NAME); String commitShortcut = configuration.getConfig(ClientConfig.class).getCommitShortcut(); Action commitAction = new BaseAction(LOOKUP_SELECT_ACTION_ID) .withCaption(messages.getMainMessage("actions.Select")) .withIcon(icons.get(CubaIcon.LOOKUP_OK)) .withPrimary(true) .withShortcut(commitShortcut) .withHandler(this::select); window.addAction(commitAction); Action closeAction = new BaseAction(LOOKUP_CANCEL_ACTION_ID) .withCaption(messages.getMainMessage("actions.Cancel")) .withIcon(icons.get(CubaIcon.LOOKUP_CANCEL)) .withHandler(this::cancel); window.addAction(closeAction); }
protected void initActions(@SuppressWarnings("unused") InitEvent event) { Window window = getWindow(); Configuration configuration = getBeanLocator().get(Configuration.NAME); Messages messages = getBeanLocator().get(Messages.NAME); Icons icons = getBeanLocator().get(Icons.NAME); String commitShortcut = configuration.getConfig(ClientConfig.class).getCommitShortcut(); Action commitAndCloseAction = new BaseAction(WINDOW_COMMIT_AND_CLOSE) .withCaption(messages.getMainMessage("actions.Ok")) .withIcon(icons.get(CubaIcon.EDITOR_OK)) .withPrimary(true) .withShortcut(commitShortcut) .withHandler(this::commitAndClose); window.addAction(commitAndCloseAction); Action commitAction = new BaseAction(WINDOW_COMMIT) .withCaption(messages.getMainMessage("actions.Save")) .withHandler(this::commit); window.addAction(commitAction); Action closeAction = new BaseAction(WINDOW_CLOSE) .withIcon(icons.get(CubaIcon.EDITOR_CANCEL)) .withCaption(messages.getMainMessage("actions.Cancel")) .withHandler(this::cancel); window.addAction(closeAction); }