use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class AbstractRoleMemberPanel method createRemoveMemberInlineMenuItems.
protected List<InlineMenuItem> createRemoveMemberInlineMenuItems() {
List<InlineMenuItem> removeMenuItems = new ArrayList<>();
removeMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.unassignMembersSelected"), false, new HeaderMenuAction(this) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
removeMembersPerformed(QueryScope.SELECTED, target);
}
}));
removeMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.unassignMembersAll"), false, new HeaderMenuAction(this) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
removeMembersPerformed(QueryScope.ALL, target);
}
}));
return removeMenuItems;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class TreeTablePanel method createTreeChildrenMenu.
private List<InlineMenuItem> createTreeChildrenMenu(OrgType org) {
List<InlineMenuItem> items = new ArrayList<>();
try {
boolean allowModify = org == null || parentPage.getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_MODIFY_ACTION_URL, AuthorizationPhaseType.REQUEST, org.asPrismObject(), null, null, null);
boolean allowRead = org == null || parentPage.getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_READ_ACTION_URL, AuthorizationPhaseType.REQUEST, org.asPrismObject(), null, null, null);
InlineMenuItem item;
if (allowModify) {
item = new InlineMenuItem(createStringResource("TreeTablePanel.move"), new ColumnMenuAction<SelectableBean<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
moveRootPerformed(getRowModel().getObject(), target);
}
});
items.add(item);
item = new InlineMenuItem(createStringResource("TreeTablePanel.makeRoot"), new ColumnMenuAction<SelectableBean<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
makeRootPerformed(getRowModel().getObject(), target);
}
});
items.add(item);
}
boolean allowDelete = org == null || parentPage.getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_DELETE_ACTION_URL, AuthorizationPhaseType.REQUEST, org.asPrismObject(), null, null, null);
if (allowDelete) {
item = new InlineMenuItem(createStringResource("TreeTablePanel.delete"), new ColumnMenuAction<SelectableBean<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
deleteNodePerformed(getRowModel().getObject(), target);
}
});
items.add(item);
}
if (allowModify) {
item = new InlineMenuItem(createStringResource("TreeTablePanel.recompute"), new ColumnMenuAction<SelectableBean<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
recomputeRootPerformed(getRowModel().getObject(), target);
}
});
items.add(item);
item = new InlineMenuItem(createStringResource("TreeTablePanel.edit"), Model.of(allowModify), Model.of(allowModify), new ColumnMenuAction<SelectableBean<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editRootPerformed(getRowModel().getObject(), target);
}
});
items.add(item);
} else if (allowRead) {
item = new InlineMenuItem(createStringResource("TreeTablePanel.viewDetails"), Model.of(allowRead), Model.of(allowRead), new ColumnMenuAction<SelectableBean<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editRootPerformed(getRowModel().getObject(), target);
}
});
items.add(item);
}
boolean allowAddNew = parentPage.getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_ADD_ACTION_URL, AuthorizationPhaseType.REQUEST, (new OrgType(parentPage.getPrismContext())).asPrismObject(), null, null, null);
if (allowModify && allowAddNew) {
item = new InlineMenuItem(createStringResource("TreeTablePanel.createChild"), new ColumnMenuAction<SelectableBean<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
try {
initObjectForAdd(ObjectTypeUtil.createObjectRef(getRowModel().getObject().getValue()), OrgType.COMPLEX_TYPE, null, target);
} catch (SchemaException e) {
throw new SystemException(e.getMessage(), e);
}
}
});
items.add(item);
}
} catch (SchemaException ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Failed to check menu items authorizations", ex);
}
return items;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class AbstractRoleMemberPanel method createMembersHeaderInlineMenu.
protected List<InlineMenuItem> createMembersHeaderInlineMenu() {
List<InlineMenuItem> headerMenuItems = new ArrayList<>();
headerMenuItems.addAll(createNewMemberInlineMenuItems());
headerMenuItems.add(new InlineMenuItem());
headerMenuItems.addAll(createRemoveMemberInlineMenuItems());
headerMenuItems.addAll(createMemberRecomputeInlineMenuItems());
return headerMenuItems;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class PageResources method initLayout.
private void initLayout() {
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createNoFetch());
options.add(SelectorOptions.create(ResourceType.F_CONNECTOR_REF, GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE)));
MainObjectListPanel<ResourceType> resourceListPanel = new MainObjectListPanel<ResourceType>(ID_TABLE, ResourceType.class, TableId.TABLE_RESOURCES, options, this) {
private static final long serialVersionUID = 1L;
@Override
protected List<InlineMenuItem> createInlineMenu() {
return PageResources.this.createRowMenuItems(false);
}
@Override
protected List<IColumn<SelectableBean<ResourceType>, String>> createColumns() {
return PageResources.this.initResourceColumns();
}
@Override
protected IColumn<SelectableBean<ResourceType>, String> createActionsColumn() {
return PageResources.this.createResourceActionsColumn();
}
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ResourceType object) {
PageResources.this.resourceDetailsPerformed(target, object.getOid());
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target) {
navigateToNext(PageResourceWizard.class);
}
};
resourceListPanel.setOutputMarkupId(true);
resourceListPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_RESOURCE_BOX_CSS_CLASSES);
mainForm.add(resourceListPanel);
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class ResourceContentPanel method initLayout.
private void initLayout() {
WebMarkupContainer totals = new WebMarkupContainer(ID_TOTALS);
totals.setOutputMarkupId(true);
add(totals);
initShadowStatistics(totals);
MainObjectListPanel<ShadowType> shadowListPanel = new MainObjectListPanel<ShadowType>(ID_TABLE, ShadowType.class, getTableId(), null, pageBase) {
private static final long serialVersionUID = 1L;
@Override
protected List<InlineMenuItem> createInlineMenu() {
return ResourceContentPanel.this.createRowMenuItems();
}
@Override
protected List<IColumn<SelectableBean<ShadowType>, String>> createColumns() {
return ResourceContentPanel.this.initColumns();
}
@Override
protected IColumn<SelectableBean<ShadowType>, String> createActionsColumn() {
return new InlineMenuHeaderColumn(createHeaderMenuItems());
}
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ShadowType object) {
shadowDetailsPerformed(target, WebComponentUtil.getName(object), object.getOid());
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target) {
// TODO Auto-generated method stub
}
@Override
protected BaseSortableDataProvider<SelectableBean<ShadowType>> initProvider() {
provider = (SelectableBeanObjectDataProvider<ShadowType>) super.initProvider();
provider.setEmptyListOnNullQuery(true);
provider.setSort(null);
createSearchOptions(provider);
return provider;
}
@Override
protected ObjectQuery createContentQuery() {
ObjectQuery parentQuery = super.createContentQuery();
List<ObjectFilter> filters = new ArrayList<>();
if (parentQuery != null) {
filters.add(parentQuery.getFilter());
}
ObjectQuery customQuery = ResourceContentPanel.this.createQuery();
if (customQuery != null && customQuery.getFilter() != null) {
filters.add(customQuery.getFilter());
}
ObjectQuery query = new ObjectQuery();
if (filters.size() == 1) {
query = ObjectQuery.createObjectQuery(filters.iterator().next());
// setProviderAvailableDataSize(query);
return query;
}
if (filters.size() == 0) {
// setProviderAvailableDataSize(query);
return null;
}
query = ObjectQuery.createObjectQuery(AndFilter.createAnd(filters));
// setProviderAvailableDataSize(query);
return query;
}
@Override
protected Search createSearch() {
return ResourceContentPanel.this.createSearch();
}
};
shadowListPanel.setOutputMarkupId(true);
shadowListPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return createQuery() != null;
}
});
shadowListPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_SHADOW_BOX_CSS_CLASSES);
add(shadowListPanel);
Label label = new Label(ID_LABEL, "Nothing to show. Select intent to search");
add(label);
label.setOutputMarkupId(true);
label.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return createQuery() == null;
}
});
OperationResult result = new OperationResult(OPERATION_SEARCH_TASKS_FOR_RESOURCE);
List<PrismObject<TaskType>> tasks = WebModelServiceUtils.searchObjects(TaskType.class, QueryBuilder.queryFor(TaskType.class, getPageBase().getPrismContext()).item(TaskType.F_OBJECT_REF).ref(getResourceModel().getObject().getOid()).build(), result, getPageBase());
List<TaskType> tasksForKind = getTasksForKind(tasks);
List<TaskType> importTasks = new ArrayList<>();
List<TaskType> syncTasks = new ArrayList<>();
List<TaskType> reconTasks = new ArrayList<>();
for (TaskType task : tasksForKind) {
if (TaskCategory.RECONCILIATION.equals(task.getCategory())) {
reconTasks.add(task);
} else if (TaskCategory.LIVE_SYNCHRONIZATION.equals(task.getCategory())) {
syncTasks.add(task);
} else if (TaskCategory.IMPORTING_ACCOUNTS.equals(task.getCategory())) {
importTasks.add(task);
}
}
initButton(ID_IMPORT, "Import", " fa-download", TaskCategory.IMPORTING_ACCOUNTS, importTasks);
initButton(ID_RECONCILIATION, "Reconciliation", " fa-link", TaskCategory.RECONCILIATION, reconTasks);
initButton(ID_LIVE_SYNC, "Live Sync", " fa-refresh", TaskCategory.LIVE_SYNCHRONIZATION, syncTasks);
initCustomLayout();
}
Aggregations