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 Action createLookupAction() { return new BaseAction("") .withIcon(icons.get(CubaIcon.PICKERFIELD_LOOKUP)) .withHandler(e -> openLookup(null)); }
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"))); }
@Override public void setLookupSelectHandler(Consumer<Collection<E>> selectHandler) { Consumer<Action.ActionPerformedEvent> actionHandler = event -> { Set<E> selected = getSelected(); selectHandler.accept(selected); }; setEnterPressAction(new BaseAction(LOOKUP_ENTER_PRESSED_ACTION_ID) .withHandler(actionHandler)); setItemClickAction(new BaseAction(LOOKUP_ITEM_CLICK_ACTION_ID) .withHandler(actionHandler)); if (buttonsPanel != null && !buttonsPanel.isAlwaysVisible()) { buttonsPanel.setVisible(false); } }
BaseAction multiUploadAction = new BaseAction("multiupload") .withCaption(getMessage("multiupload")) .withHandler(event -> { if (!security.isEntityOpPermitted(FileDescriptor.class, EntityOp.READ)) { throw new AccessDeniedException(PermissionType.ENTITY_OP, FileDescriptor.class.getSimpleName()); }); multiUploadAction.setEnabled(security.isEntityOpPermitted(FileDescriptor.class, EntityOp.CREATE)); multiUploadBtn.setAction(multiUploadAction);
@Override public void init(Map<String, Object> params) { super.init(params); List<Report> reports = reportsParameter; if (reports == null) { reports = reportGuiManager.getAvailableReports(screenParameter, userSessionSource.getUserSession().getUser(), null); } if (reportsParameter != null) { gridFilter.setVisible(false); } for (Report report : reports) { reportDs.includeItem(report); } Action runAction = new ItemTrackingAction(RUN_ACTION_ID) .withCaption(getMessage("runReport")) .withHandler(e -> { Report report = reportsTable.getSingleSelected(); if (report != null) { report = getDsContext().getDataSupplier().reload(report, ReportService.MAIN_VIEW_NAME); reportGuiManager.runReport(report, ReportRun.this); } }); reportsTable.addAction(runAction); reportsTable.setItemClickAction(runAction); addAction(new BaseAction("applyFilter") .withShortcut(clientConfig.getFilterApplyShortcut()) .withHandler(e -> { filterReports(); })); }
@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"); } }); }
BaseAction importAction = new BaseAction("import") .withHandler(event -> { openWindow("report$Report.importDialog", OpenType.DIALOG) .addCloseListener(actionId -> { }); importAction.setEnabled(hasPermissionsToCreateReports); importReport.setAction(importAction);
protected Action loadStubAction(Element element, String id, boolean shouldTrackSelection) { Action targetAction; if (shouldTrackSelection) { targetAction = new ItemTrackingAction(id); } else { targetAction = new BaseAction(id); } initAction(element, targetAction); return targetAction; }
/** * Initializes OK/Cancel editor buttons. */ protected void initOkCancelActions() { ((BaseAction) getWindow().getActionNN("save")).withHandler(actionPerformedEvent -> saveChanges()); ((BaseAction) getWindow().getActionNN("cancel")).withHandler(actionPerformedEvent -> discardChanges()); }
); if (!security.isEntityAttrUpdatePermitted(metadata.getClass(Constraint.class), "group")) { moveToGroupAction.setEnabled(false);
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; }
jmxConnectionField.addAction(new BaseAction("actions.Add") .withIcon("icons/plus-btn.png") .withHandler(event -> { JmxInstanceEditor instanceEditor = (JmxInstanceEditor) openEditor( metadata.create(JmxInstance.class), OpenType.DIALOG);
@Override public void setLookupSelectHandler(Consumer<Collection<E>> selectHandler) { Consumer<Action.ActionPerformedEvent> actionHandler = event -> { Set<E> selected = getSelected(); selectHandler.accept(selected); }; setItemClickAction(new BaseAction(Window.Lookup.LOOKUP_ITEM_CLICK_ACTION_ID) .withHandler(actionHandler) ); if (buttonsPanel != null && !buttonsPanel.isAlwaysVisible()) { buttonsPanel.setVisible(false); } }
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") )); }
jmxConnectionField.addAction(action); jmxConnectionField.addAction(new BaseAction("actions.Add") .withIcon("icons/plus-btn.png") .withHandler(event -> { JmxInstanceEditor instanceEditor = (JmxInstanceEditor) openEditor( metadata.create(JmxInstance.class), OpenType.DIALOG);
@Override public void setLookupSelectHandler(Consumer<Collection<E>> selectHandler) { Consumer<Action.ActionPerformedEvent> actionHandler = event -> { Set<E> selected = getSelected(); selectHandler.accept(selected); }; setEnterPressAction( new BaseAction(Window.Lookup.LOOKUP_ENTER_PRESSED_ACTION_ID) .withHandler(actionHandler) ); setItemClickAction( new BaseAction(Window.Lookup.LOOKUP_ITEM_CLICK_ACTION_ID) .withHandler(actionHandler) ); if (isEditable()) { EntityTableItems<E> entityTableSource = (EntityTableItems<E>) getItems(); com.vaadin.v7.data.Container ds = component.getContainerDataSource(); @SuppressWarnings("unchecked") Collection<MetaPropertyPath> propertyIds = (Collection<MetaPropertyPath>) ds.getContainerPropertyIds(); disableEditableColumns(entityTableSource, propertyIds); } if (buttonsPanel != null && !buttonsPanel.isAlwaysVisible()) { buttonsPanel.setVisible(false); } }
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); }
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); }