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; }
/** * Check permissions for Action */ @Override protected boolean isPermitted() { if (target == null || target.getDatasource() == null) { return false; } if (!checkRemovePermission()) { return false; } return super.isPermitted(); }
@Override public String getCaption() { return super.getCaption(); } }
protected void initMoveButtons() { Action moveUpAction = new ItemTrackingAction("moveUp") .withCaption("") .withHandler(event -> { Set<CategoryAttribute> selected = categoryAttrsTable.getSelected(); ((Button) getComponentNN("moveUp")).setAction(moveUpAction); Action moveDownAction = new ItemTrackingAction("moveDown") .withCaption("") .withHandler(event -> { Set<CategoryAttribute> selected = categoryAttrsTable.getSelected();
constraintsTable.addAction(constraintCreateAction); Action activateAction = new ItemTrackingAction("activate") .withHandler(event -> { Constraint constraint = constraintsTable.getSingleSelected(); if (constraint != null) { BaseAction moveToGroupAction = new ItemTrackingAction("moveToGroup") .withCaption(getMessage("actions.constraint.moveToGroup")) .withIcon("icons/move.png") .withHandler(e ->
protected void initUsersTableActions() { userCreateAction = new GroupPropertyCreateAction(usersTable); userCreateAction.setAfterCommitHandler(entity -> usersTable.getDatasource().refresh() ); usersTable.addAction(userCreateAction); usersTable.addAction(new UserRemoveAction(usersTable, userManagementService)); Action moveToGroupAction = new ItemTrackingAction("moveToGroup") .withIcon("icons/move.png") .withCaption(getMessage("moveToGroup")) .withHandler(event -> { Set<User> selected = usersTable.getSelected(); if (!selected.isEmpty()) { moveUsersToGroup(selected); } }); moveToGroupAction.setEnabled(security.isEntityOpPermitted(User.class, EntityOp.UPDATE)); usersTable.addAction(moveToGroupAction); }
@Override public boolean isEnabled() { return super.isEnabled() && isUpdatePermitted(); } };
@Override public void setCaption(String caption) { super.setCaption(caption); captionInitialized = true; }
@Override protected boolean isApplicable() { return super.isApplicable() && target.getSelected().size() == 1; } }
@Override public void refreshState() { super.refreshState(); if (target == null || target.getDatasource() == null) return; if (!captionInitialized) { Messages messages = AppBeans.get(Messages.NAME); if (security.isEntityOpPermitted(target.getDatasource().getMetaClass(), EntityOp.UPDATE)) { setCaption(messages.getMainMessage("actions.Edit")); } else { setCaption(messages.getMainMessage("actions.View")); } } }
super.init(params); Action copyRoles = new ItemTrackingAction("copy") .withCaption(getMessage("actions.Copy")) .withHandler(event -> { userManagementService.copyRole(rolesTable.getSingleSelected().getId()); Action assignToUsersAction = new ItemTrackingAction(rolesTable, "assignToUsers") .withCaption(getMessage("assignToUsers")) .withHandler(event -> { Set<Role> selected = rolesTable.getSelected();
metadata.getClassNN(Report.class), EntityOp.CREATE); Action copyAction = new ItemTrackingAction("copy") .withCaption(getMessage("copy")) .withHandler(event -> { Report report = reportsTable.getSingleSelected(); copyReport.setAction(copyAction); runReport.setAction(new ItemTrackingAction("runReport") .withCaption(getMessage("runReport")) .withHandler(event -> { Report report = reportsTable.getSingleSelected(); importReport.setAction(importAction); Action exportAction = new ItemTrackingAction("export") .withHandler(event -> { Set<Report> reports = reportsTable.getSelected(); if ((reports != null) && (!reports.isEmpty())) {
@Override public boolean isEnabled() { return super.isEnabled() && isUpdatePermitted(); } };
super.init(params); filesTable.addAction(new ItemTrackingAction("download") .withCaption(getMessage("download")) .withHandler(event -> { FileDescriptor fileDescriptor = filesTable.getSingleSelected();
@Override public boolean isPermitted() { if (super.isPermitted()) { Set<ChartSeries> items = seriesTable.getSelected(); if (!CollectionUtils.isEmpty(items) && items.size() == 1) { Integer order = (IterableUtils.get(items, 0)).getOrder(); if (order != null) { return up ? order > 1 : order < seriesDs.size(); } } } return false; } }
@Override public boolean isEnabled() { return super.isEnabled() && isUpdatePermitted(); } });
@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(); })); }
/** * Check permissions for Action */ @Override protected boolean isPermitted() { if (target == null || target.getDatasource() == null) { return false; } CollectionDatasource ownerDatasource = target.getDatasource(); boolean entityOpPermitted = security.isEntityOpPermitted(ownerDatasource.getMetaClass(), EntityOp.READ); if (!entityOpPermitted) { return false; } return super.isPermitted(); }
Action restoreAction = new ItemTrackingAction("restore") .withCaption(getMessage("entityRestore.restore")) .withPrimary(true) .withHandler(event ->
Action inspectAction = new ItemTrackingAction("inspect") .withCaption(getMessage("action.inspect")) .withHandler(event -> { Set<ManagedBeanInfo> selected = mbeansTable.getSelected();