use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class PageArchetypes method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ArchetypeType> table = new MainObjectListPanel<ArchetypeType>(ID_TABLE, ArchetypeType.class) {
@Override
protected TableId getTableId() {
return UserProfileStorage.TableId.TABLE_ARCHETYPES;
}
@Override
protected IColumn<SelectableBean<ArchetypeType>, String> createCheckboxColumn() {
return null;
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel 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.gui.api.component.MainObjectListPanel 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);
}
use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class ResourceTasksPanel method initLayout.
protected void initLayout() {
final MainObjectListPanel<TaskType> tasksPanel = new MainObjectListPanel<>(ID_TASKS_TABLE, TaskType.class, null) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_RESOURCE_TASKS_PANEL;
}
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> createResourceTasksQuery(), null);
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return null;
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation, CompiledObjectCollectionView collectionView) {
if (collectionView == null) {
collectionView = getObjectCollectionView();
}
List<ObjectReferenceType> archetypeRef = ObjectCollectionViewUtil.getArchetypeReferencesList(collectionView);
try {
PrismContext prismContext = getPrismContext();
PrismObjectDefinition<TaskType> def = prismContext.getSchemaRegistry().findObjectDefinitionByType(TaskType.COMPLEX_TYPE);
PrismObject<TaskType> obj = def.instantiate();
TaskType newTask = obj.asObjectable();
ObjectReferenceType resourceRef = new ObjectReferenceType();
resourceRef.setOid(ResourceTasksPanel.this.getModelObject().getOid());
resourceRef.setType(ResourceType.COMPLEX_TYPE);
newTask.setObjectRef(resourceRef);
WebComponentUtil.initNewObjectWithReference(getPageBase(), newTask, archetypeRef);
} catch (SchemaException ex) {
getPageBase().getFeedbackMessages().error(ResourceTasksPanel.this, ex.getUserFriendlyMessage());
target.add(getPageBase().getFeedbackPanel());
}
}
@Override
protected List<IColumn<SelectableBean<TaskType>, String>> createDefaultColumns() {
return ColumnUtils.getDefaultTaskColumns();
}
@Override
protected List<CompiledObjectCollectionView> getNewObjectInfluencesList() {
List<CompiledObjectCollectionView> newObjectInfluencesList = super.getNewObjectInfluencesList();
List<CompiledObjectCollectionView> filteredInfluencesList = new ArrayList<>();
if (newObjectInfluencesList != null) {
newObjectInfluencesList.forEach(influence -> {
if (influence.getCollection() != null && influence.getCollection().getCollectionRef() != null && ArrayUtils.contains(resourceTaskArchetypeOids, influence.getCollection().getCollectionRef().getOid())) {
filteredInfluencesList.add(influence);
}
});
}
return filteredInfluencesList;
}
};
tasksPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_TASK_BOX_CSS_CLASSES);
add(tasksPanel);
AjaxButton runNow = new AjaxButton(ID_RUN_NOW, getPageBase().createStringResource("pageTaskEdit.button.runNow")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedRealObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.runNowPerformed(oids, getPageBase());
getPageBase().showResult(result);
} else {
noTasksSelected();
}
target.add(getPageBase().getFeedbackPanel());
}
};
add(runNow);
AjaxButton resume = new AjaxButton(ID_RESUME, getPageBase().createStringResource("pageTaskEdit.button.resume")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<TaskType> tasks = getTaskListPanel().getSelectedRealObjects();
if (!tasks.isEmpty()) {
OperationResult result = TaskOperationUtils.resumeTasks(tasks, getPageBase());
getPageBase().showResult(result);
} else {
noTasksSelected();
}
target.add(getPageBase().getFeedbackPanel());
}
};
add(resume);
AjaxButton suspend = new AjaxButton(ID_SUSPEND, getPageBase().createStringResource("pageTaskEdit.button.suspend")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<TaskType> tasks = getTaskListPanel().getSelectedRealObjects();
if (!tasks.isEmpty()) {
OperationResult result = TaskOperationUtils.suspendTasks(tasks, getPageBase());
getPageBase().showResult(result);
} else {
noTasksSelected();
}
target.add(getPageBase().getFeedbackPanel());
}
};
add(suspend);
}
use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class PageRoles method initLayout.
protected void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<RoleType> table = new MainObjectListPanel<RoleType>(ID_TABLE, RoleType.class) {
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_ROLES;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
FocusListInlineMenuHelper<RoleType> listInlineMenuHelper = new FocusListInlineMenuHelper<RoleType>(RoleType.class, PageRoles.this, this) {
private static final long serialVersionUID = 1L;
protected boolean isShowConfirmationDialog(ColumnMenuAction action) {
return PageRoles.this.isShowConfirmationDialog(action);
}
protected IModel<String> getConfirmationMessageModel(ColumnMenuAction action, String actionName) {
return PageRoles.this.getConfirmationMessageModel(action, actionName);
}
};
return listInlineMenuHelper.createRowActions(getType());
}
// @Override
// protected List<IColumn<SelectableBean<RoleType>, String>> createDefaultColumns() {
// return ColumnUtils.getDefaultRoleColumns();
// }
@Override
protected List<ItemPath> getFixedSearchItems() {
List<ItemPath> fixedSearchItems = new ArrayList<>();
fixedSearchItems.add(ObjectType.F_NAME);
fixedSearchItems.add(AbstractRoleType.F_DISPLAY_NAME);
fixedSearchItems.add(AbstractRoleType.F_IDENTIFIER);
return fixedSearchItems;
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
Aggregations