use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class PageCertDefinitions method createInlineMenu.
private List<InlineMenuItem> createInlineMenu() {
List<InlineMenuItem> menu = new ArrayList<>();
menu.add(new ButtonInlineMenuItem(createStringResource("PageCertDefinitions.button.createCampaign")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<AccessCertificationDefinitionType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AccessCertificationDefinitionType campaign = getRowModel().getObject().getValue();
createCampaignPerformed(target, campaign);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_START_MENU_ITEM);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
menu.add(new ButtonInlineMenuItem(createStringResource("PageCertDefinitions.button.showCampaigns")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<AccessCertificationDefinitionType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AccessCertificationDefinitionType campaign = getRowModel().getObject().getValue();
showCampaignsPerformed(target, campaign);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-files-o");
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
menu.add(new ButtonInlineMenuItem(createStringResource("PageCertDefinitions.button.deleteDefinition")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<AccessCertificationDefinitionType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AccessCertificationDefinitionType campaign = getRowModel().getObject().getValue();
deleteConfirmation(target, campaign);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_DELETE_MENU_ITEM);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
return menu;
}
use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class ChildCasesTabPanel method initLayout.
private void initLayout() {
setOutputMarkupId(true);
MainObjectListPanel<CaseType> table = new MainObjectListPanel<CaseType>(ID_CHILD_CASES_PANEL, CaseType.class, Collections.emptyList()) {
@Override
protected List<IColumn<SelectableBean<CaseType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<CaseType>, String>> columns = new ArrayList<IColumn<SelectableBean<CaseType>, String>>();
IColumn column = new PropertyColumn(createStringResource("pageCases.table.description"), "value.description");
columns.add(column);
columns.add(ColumnUtils.createCaseActorsColumn(ChildCasesTabPanel.this.getPageBase()));
column = new PropertyColumn<SelectableBeanImpl<CaseType>, String>(createStringResource("pageCases.table.state"), CaseType.F_STATE.getLocalPart(), "value.state") {
@Override
public String getCssClass() {
return "col-sm-2 col-md-1";
}
};
columns.add(column);
column = new AbstractExportableColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.workitems")) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem, String componentId, IModel<SelectableBean<CaseType>> model) {
cellItem.add(new Label(componentId, model.getObject().getValue() != null && model.getObject().getValue().getWorkItem() != null ? model.getObject().getValue().getWorkItem().size() : null));
}
@Override
public IModel<String> getDataModel(IModel<SelectableBean<CaseType>> rowModel) {
return Model.of(rowModel.getObject().getValue() != null && rowModel.getObject().getValue().getWorkItem() != null ? Integer.toString(rowModel.getObject().getValue().getWorkItem().size()) : "");
}
@Override
public String getCssClass() {
return "col-md-2 col-lg-1";
}
};
columns.add(column);
return (List) columns;
}
@Override
protected boolean isCreateNewObjectEnabled() {
return false;
}
@Override
protected ISelectableDataProvider<CaseType, SelectableBean<CaseType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> getChildCasesQuery(), null);
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_CASE_CHILD_CASES_TAB;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return new ArrayList<>();
}
@Override
protected IColumn<SelectableBean<CaseType>, String> createCheckboxColumn() {
return null;
}
};
table.setOutputMarkupId(true);
add(table);
}
use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class TreeTablePanel method createTreeChildrenMenu.
private List<InlineMenuItem> createTreeChildrenMenu(TreeSelectableBean<OrgType> org) {
List<InlineMenuItem> items = new ArrayList<>();
boolean isAllowModify = isAllowModify(org.getValue());
boolean isAllowRead = isAllowRead(org.getValue());
InlineMenuItem item;
if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_ORG_MOVE_ACTION_URI)) {
item = new InlineMenuItem(createStringResource("TreeTablePanel.move")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
moveRootPerformed(org, target);
}
};
}
};
items.add(item);
}
if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_ORG_MAKE_ROOT_ACTION_URI)) {
item = new InlineMenuItem(createStringResource("TreeTablePanel.makeRoot")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
makeRootPerformed(org, target);
}
};
}
};
items.add(item);
}
item = new InlineMenuItem(createStringResource("TreeTablePanel.delete")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
deleteNodePerformed(org, target);
}
};
}
@Override
public IModel<Boolean> getVisible() {
return Model.of(isAllowDelete(org.getValue()));
}
};
items.add(item);
item = new InlineMenuItem(createStringResource("TreeTablePanel.recompute")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
recomputeRootPerformed(org, target);
}
};
}
@Override
public IModel<Boolean> getVisible() {
return Model.of(isAllowModify);
}
};
items.add(item);
InlineMenuItem editMenuItem = new InlineMenuItem(createStringResource("TreeTablePanel.edit")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editRootPerformed(org);
}
};
}
@Override
public IModel<Boolean> getVisible() {
return Model.of(isAllowModify);
}
};
items.add(editMenuItem);
item = new InlineMenuItem(createStringResource("TreeTablePanel.viewDetails")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editRootPerformed(org);
}
};
}
@Override
public IModel<Boolean> getVisible() {
return Model.of(!editMenuItem.getVisible().getObject() && isAllowRead);
}
};
items.add(item);
item = new InlineMenuItem(createStringResource("TreeTablePanel.createChild")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<OrgType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
try {
initObjectForAdd(ObjectTypeUtil.createObjectRef(org.getValue(), getPageBase().getPrismContext()), target);
} catch (SchemaException e) {
throw new SystemException(e.getMessage(), e);
}
}
};
}
@Override
public IModel<Boolean> getVisible() {
return Model.of(isAllowRead && isAllowAddNew());
}
};
items.add(item);
return items;
}
use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class ChildCasesPanel method initLayout.
protected void initLayout() {
setOutputMarkupId(true);
MainObjectListPanel<CaseType> table = new MainObjectListPanel<CaseType>(ID_CHILD_CASES_PANEL, CaseType.class, Collections.emptyList()) {
@Override
protected List<IColumn<SelectableBean<CaseType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<CaseType>, String>> columns = new ArrayList<IColumn<SelectableBean<CaseType>, String>>();
IColumn column = new PropertyColumn(createStringResource("pageCases.table.description"), "value.description");
columns.add(column);
columns.add(ColumnUtils.createCaseActorsColumn(ChildCasesPanel.this.getPageBase()));
column = new PropertyColumn<SelectableBeanImpl<CaseType>, String>(createStringResource("pageCases.table.state"), CaseType.F_STATE.getLocalPart(), "value.state") {
@Override
public String getCssClass() {
return "col-sm-2 col-md-1";
}
};
columns.add(column);
column = new AbstractExportableColumn<SelectableBean<CaseType>, String>(createStringResource("pageCases.table.workitems")) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem, String componentId, IModel<SelectableBean<CaseType>> model) {
cellItem.add(new Label(componentId, model.getObject().getValue() != null && model.getObject().getValue().getWorkItem() != null ? model.getObject().getValue().getWorkItem().size() : null));
}
@Override
public IModel<String> getDataModel(IModel<SelectableBean<CaseType>> rowModel) {
return Model.of(rowModel.getObject().getValue() != null && rowModel.getObject().getValue().getWorkItem() != null ? Integer.toString(rowModel.getObject().getValue().getWorkItem().size()) : "");
}
@Override
public String getCssClass() {
return "col-md-2 col-lg-1";
}
};
columns.add(column);
return (List) columns;
}
@Override
protected boolean isCreateNewObjectEnabled() {
return false;
}
@Override
protected ISelectableDataProvider<CaseType, SelectableBean<CaseType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> getChildCasesQuery(), null);
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_CASE_CHILD_CASES_TAB;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return new ArrayList<>();
}
@Override
protected IColumn<SelectableBean<CaseType>, String> createCheckboxColumn() {
return null;
}
};
table.setOutputMarkupId(true);
add(table);
}
use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class InternalsLoggedInUsersPanel method initLayout.
private void initLayout() {
MainObjectListPanel<F> table = new MainObjectListPanel(ID_TABLE, FocusType.class, null) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ObjectType object) {
if (WebComponentUtil.hasDetailsPage(object.getClass())) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, object.getOid());
getPageBase().navigateToNext(WebComponentUtil.getObjectDetailsPage(object.getClass()), parameters);
}
}
@Override
protected List<IColumn<SelectableBean<F>, String>> createDefaultColumns() {
return InternalsLoggedInUsersPanel.this.initColumns();
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return initInlineMenu();
}
@Override
protected UserProfileStorage.TableId getTableId() {
return null;
}
@Override
protected ISelectableDataProvider<UserSessionManagementType, SelectableBean<F>> createProvider() {
LoadableModel<List<UserSessionManagementType>> principals = new LoadableModel<List<UserSessionManagementType>>(true) {
@Override
protected List<UserSessionManagementType> load() {
return loadLoggedInPrincipals();
}
};
return new SelectableListDataProvider<SelectableBean<F>, UserSessionManagementType>(InternalsLoggedInUsersPanel.this, principals) {
@Override
protected SelectableBean<F> createObjectWrapper(UserSessionManagementType principal) {
SelectableBeanImpl<F> user = new SelectableBeanImpl<>((F) principal.getFocus());
user.setActiveSessions(principal.getActiveSessions());
user.setNodes(principal.getNode());
return user;
}
};
}
@Override
protected boolean isCreateNewObjectEnabled() {
return false;
}
@Override
protected List<Component> createToolbarButtonsList(String buttonId) {
return new ArrayList<>();
}
@Override
protected boolean enableSavePageSize() {
return false;
}
};
add(table);
}
Aggregations