protected void initWindowActions() { addAction(new BaseAction("windowCommit") .withHandler(event -> close(COMMIT_ACTION_ID)) .withCaption(getMessage("actions.Ok"))); addAction(new BaseAction("windowClose") .withHandler(event -> close(CLOSE_ACTION_ID)) .withCaption(getMessage("actions.Cancel"))); }
protected Button createInstanceButton(String entityName, SearchResultEntry entry) { LinkButton instanceBtn = componentsFactory.createComponent(LinkButton.class); instanceBtn.setStyleName("fts-found-instance"); BaseAction action = new BaseAction("instanceButton"); action.withCaption(entry.getCaption()); action.withHandler(e -> onInstanceClick(entityName, entry)); instanceBtn.setAction(action); return instanceBtn; }
protected void initShortcuts() { Action commitAction = new BaseAction("commitAndClose") .withCaption(messages.getMainMessage("actions.OkClose")) .withShortcut(configuration.getConfig(ClientConfig.class).getCommitShortcut()) .withHandler(e -> commitAndClose() ); addAction(commitAction); }
protected void initLookupActions(@SuppressWarnings("unused") InitEvent event) { addAction(new SelectAction(this)); Messages messages = getBeanLocator().get(Messages.NAME); addAction(new BaseAction(LOOKUP_CANCEL_ACTION_ID) .withCaption(messages.getMainMessage("actions.Cancel")) .withHandler(e -> close("cancel") )); }
protected Action initCreateScreenAndComponentAction() { return new BaseAction("create") .withCaption(getMessage("targetScreensTable.create")) .withIcon(icons.get(CubaIcon.CREATE_ACTION)) .withShortcut(clientConfig.getTableInsertShortcut()) .withHandler(e -> screensDs.addItem(metadata.create(ScreenAndComponent.class)) ); }
protected void addClearBtn() { clearBtn = uiComponents.create(Button.class); clearBtn.setIconFromSet(CubaIcon.PICKERFIELD_CLEAR); clearBtn.setStyleName("c-listeditor-button"); clearBtn.setCaption(""); clearBtn.setAction(new BaseAction("clear") .withCaption("Clear") .withHandler(event -> actualField.setValue(null) )); layout.add(clearBtn); }
public void resetRememberMe() { if (usersTable.getSelected().isEmpty()) { showOptionDialog( getMessage("resetRememberMeTitle"), getMessage("resetRememberMeQuestion"), MessageType.CONFIRMATION, new Action[]{ new BaseAction("actions.ResetAll") .withCaption(getMessage("actions.ResetAll")) .withHandler(event -> resetRememberMeAll()), new DialogAction(Type.CANCEL, Status.PRIMARY) } ); } else { showOptionDialog( getMessage("resetRememberMeTitle"), getMessage("resetRememberMeQuestion"), MessageType.CONFIRMATION, new Action[]{ new BaseAction("actions.ResetOptionSelected") .withCaption(getMessage("actions.ResetOptionSelected")) .withHandler(event -> resetRememberMe(usersTable.getSelected())), new BaseAction("actions.ResetOptionAll") .withCaption(getMessage("actions.ResetOptionAll")) .withHandler(event -> resetRememberMeAll()), new DialogAction(Type.CANCEL, Status.PRIMARY) } ); } }
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); }
@Override public void actionPerform(Component component) { if (beforeActionPerformedHandler != null) { if (!beforeActionPerformedHandler.beforeActionPerformed()) return; } Messages messages = AppBeans.get(Messages.NAME); if (target.getSelected().isEmpty() || target.getDatasource().size() <= 1) { showPivotTable(ALL_ROWS); } else { Action[] actions = new Action[]{ new BaseAction("actions.showPivotAction.SELECTED_ROWS") .withCaption(messages.getMainMessage("actions.showPivotAction.SELECTED_ROWS")) .withHandler(event -> showPivotTable(SELECTED_ROWS)), new BaseAction("actions.showPivotAction.ALL_ROWS") .withCaption(messages.getMainMessage("actions.showPivotAction.ALL_ROWS")) .withHandler(event -> showPivotTable(ALL_ROWS)), new DialogAction(DialogAction.Type.CANCEL) }; WindowManager wm = target.getFrame().getWindowManager(); wm.showOptionDialog( messages.getMainMessage("actions.showPivotAction.dialogTitle"), messages.getMainMessage("actions.showPivotAction.dialogMessage"), Frame.MessageType.CONFIRMATION, actions); } }
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); }
.withCaption(messages.getMainMessage("actions.OkClose")) .withPrimary(true) .withShortcut(commitShortcut) .withCaption(messages.getMainMessage(commitAndCloseButtonExists ? "actions.Save" : "actions.Ok")) .withPrimary(!commitAndCloseButtonExists) .withShortcut(commitAndCloseButtonExists ? null : commitShortcut) .withCaption(messages.getMainMessage("actions.Cancel")) .withHandler(e -> close(commitActionPerformed ? Window.COMMIT_ACTION_ID : getId())
protected void addRow(Object value, ComponentContainer parent, boolean isReadOnly) { BoxLayout row = componentsFactory.createComponent(HBoxLayout.class); row.setSpacing(true); row.setWidthFull(); TextField valueField = componentsFactory.createComponent(TextField.class); valueField.setValue(value); valueField.setEditable(!isReadOnly); row.add(valueField); row.expand(valueField); Button btnRemove = componentsFactory.createComponent(Button.class); btnRemove.setIconFromSet(CubaIcon.TIMES); btnRemove.setDescription(messages.getMessage(getClass(), "editAttribute.array.btnRemove")); Action removeRowAction = new BaseAction("removeRow") .withCaption("") .withHandler(actionPerformedEvent -> parent.remove(row) ); removeRowAction.setEnabled(!isReadOnly); btnRemove.setAction(removeRowAction); row.add(btnRemove); parent.add(row); }
protected void logoutPrompt() { Dialogs dialogs = ((AppUI) getUI()).getDialogs(); dialogs.createOptionDialog(MessageType.WARNING) .withCaption(messages.getMainMessage("exceptionDialog.logoutCaption")) .withMessage(messages.getMainMessage("exceptionDialog.logoutMessage")) .withActions( new BaseAction("close") .withCaption(messages.getMainMessage("closeApplication")) .withIcon("icons/ok.png") .withHandler(event -> forceLogout()), new DialogAction(Type.CANCEL, Status.PRIMARY) ) .show(); }
LinkButton pageButton = componentsFactory.createComponent(LinkButton.class); BaseAction action = new BaseAction("page_" + page.getPageNumber()) .withCaption(page.getDisplayedPageNumber()) .withHandler(e -> openPage(page)); pageButton.setAction(action); LinkButton nextPageButton = componentsFactory.createComponent(LinkButton.class); BaseAction action = new BaseAction("nextPage") .withCaption(getMessage("nextPage")) .withHandler(e -> openNextPage()); nextPageButton.setAction(action);
.withCaption(getMessage("multiupload")) .withHandler(event -> { if (!security.isEntityOpPermitted(FileDescriptor.class, EntityOp.READ)) {
.withCaption(getMessage("activate")) .withHandler(e -> { Set<ScheduledTask> tasks = tasksTable.getSelected();
.withCaption("") .withHandler(actionPerformedEvent -> addRow(null, scrollBoxLayout, false)
@Override public void init(Map<String, Object> params) { categoryTable.addAction(new CreateAction()); categoryTable.addAction(new EditAction()); categoryTable.addAction(new RemoveAction(categoryTable)); categoryTable.addAction(new BaseAction("applyChanges") .withCaption(getMessage("categoryTable.applyChanges")) .withHandler(actionPerformedEvent -> { dynamicAttributesCacheService.loadCache(); clientCacheManager.refreshCached(DynamicAttributesCacheStrategy.NAME); permissionConfig.clearConfigCache(); showNotification(getMessage("notification.changesApplied")); })); categoryTable.removeGeneratedColumn("entityType"); categoryTable.addGeneratedColumn("entityType", entity -> { Label dataTypeLabel = componentsFactory.createComponent(Label.class); MetaClass meta = metadata.getSession().getClassNN(entity.getEntityType()); dataTypeLabel.setValue(messageTools.getEntityCaption(meta)); return dataTypeLabel; }); }
/** * Check modifications and close all screens in all main windows excluding root screens. * * @return operation result */ public OperationResult checkModificationsAndCloseAll() { if (hasUnsavedChanges()) { UnknownOperationResult result = new UnknownOperationResult(); ui.getDialogs().createOptionDialog() .withCaption(messages.getMainMessage("closeUnsaved.caption")) .withMessage(messages.getMainMessage("discardChangesOnClose")) .withActions( new BaseAction("closeApplication") .withCaption(messages.getMainMessage("closeApplication")) .withIcon(icons.get(CubaIcon.DIALOG_OK)) .withHandler(event -> { closeWindowsInternal(); result.success(); }), new DialogAction(DialogAction.Type.CANCEL, Action.Status.PRIMARY) .withHandler(event -> result.fail()) ) .show(); return result; } else { closeWindowsInternal(); return OperationResult.success(); } }
new BaseAction("discard") .withIcon(icons.get(CubaIcon.DIALOG_CANCEL)) .withCaption(messages.getMainMessage("closeUnsaved.discard")) .withHandler(e -> {