use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class ResourceTasksPanel method initLayout.
private void initLayout(final ListModel<TaskType> tasks) {
final MainObjectListPanel<TaskType> tasksPanel = new MainObjectListPanel<TaskType>(ID_TASKS_TABLE, TaskType.class, TableId.PAGE_RESOURCE_TASKS_PANEL, null, pageBase) {
private static final long serialVersionUID = 1L;
@Override
protected BaseSortableDataProvider<SelectableBean<TaskType>> initProvider() {
return new ListDataProvider2(pageBase, tasks);
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
// TODO Auto-generated method stub
return null;
}
@Override
public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
// TODO Auto-generated method stub
// super.objectDetailsPerformed(target, task);
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
getPageBase().navigateToNext(PageTaskEdit.class, parameters);
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target) {
getPageBase().navigateToNext(PageTaskAdd.class);
}
@Override
protected List<IColumn<SelectableBean<TaskType>, String>> createColumns() {
return ColumnUtils.getDefaultTaskColumns();
}
};
// final ObjectListPanel<TaskType> tasksPanel = new ObjectListPanel<TaskType>(ID_TASKS_TABLE, TaskType.class, pageBase){
//
// @Override
// protected BaseSortableDataProvider<SelectableBean<TaskType>> getProvider() {
// return new ListDataProvider2(pageBase, tasks);
// }
//
// @Override
// public boolean isEditable() {
// return ResourceTasksPanel.this.editable;
// }
//
// @Override
// public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
// // TODO Auto-generated method stub
// super.objectDetailsPerformed(target, task);
// PageParameters parameters = new PageParameters();
// parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
// setResponsePage(new PageTaskEdit(parameters));
// }
// };
// tasksPanel.setEditable(false);
tasksPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_TASK_BOX_CSS_CLASSES);
add(tasksPanel);
AjaxButton runNow = new AjaxButton(ID_RUN_NOW, pageBase.createStringResource("pageTaskEdit.button.runNow")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.runNowPerformed(pageBase.getTaskService(), oids);
pageBase.showResult(result);
} else {
noTasksSelected();
}
target.add(pageBase.getFeedbackPanel());
}
};
add(runNow);
AjaxButton resume = new AjaxButton(ID_RESUME, pageBase.createStringResource("pageTaskEdit.button.resume")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.resumePerformed(pageBase.getTaskService(), oids);
pageBase.showResult(result);
} else {
noTasksSelected();
}
target.add(pageBase.getFeedbackPanel());
}
};
add(resume);
AjaxButton suspend = new AjaxButton(ID_SUSPEND, pageBase.createStringResource("pageTaskEdit.button.suspend")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.suspendPerformed(pageBase.getTaskService(), oids);
pageBase.showResult(result);
} else {
noTasksSelected();
}
target.add(pageBase.getFeedbackPanel());
}
};
add(suspend);
}
use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class AbstractRoleMemberPanel method initMemberTable.
private void initMemberTable(TableId tableId, Form form) {
WebMarkupContainer memberContainer = new WebMarkupContainer(ID_CONTAINER_MEMBER);
memberContainer.setOutputMarkupId(true);
memberContainer.setOutputMarkupPlaceholderTag(true);
form.add(memberContainer);
MainObjectListPanel<ObjectType> childrenListPanel = new MainObjectListPanel<ObjectType>(ID_MEMBER_TABLE, ObjectType.class, tableId, getSearchOptions(), getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ObjectType object) {
detailsPerformed(target, object);
}
@Override
protected boolean isClickable(IModel<SelectableBean<ObjectType>> rowModel) {
if (rowModel == null || rowModel.getObject() == null || rowModel.getObject().getValue() == null) {
return false;
}
Class<?> objectClass = rowModel.getObject().getValue().getClass();
return WebComponentUtil.hasDetailsPage(objectClass);
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target) {
AbstractRoleMemberPanel.this.createFocusMemberPerformed(null, target);
}
@Override
protected List<IColumn<SelectableBean<ObjectType>, String>> createColumns() {
return createMembersColumns();
}
@Override
protected IColumn<SelectableBean<ObjectType>, String> createActionsColumn() {
return new InlineMenuHeaderColumn(createMembersHeaderInlineMenu());
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return new ArrayList<>();
}
@Override
protected ObjectQuery createContentQuery() {
ObjectQuery q = super.createContentQuery();
ObjectQuery members = AbstractRoleMemberPanel.this.createContentQuery();
List<ObjectFilter> filters = new ArrayList<>();
if (q != null && q.getFilter() != null) {
filters.add(q.getFilter());
}
if (members != null && members.getFilter() != null) {
filters.add(members.getFilter());
}
if (filters.size() == 1) {
return ObjectQuery.createObjectQuery(filters.iterator().next());
}
return ObjectQuery.createObjectQuery(AndFilter.createAnd(filters));
}
};
childrenListPanel.setOutputMarkupId(true);
memberContainer.add(childrenListPanel);
}
use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class PageCertDefinitions method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<AccessCertificationDefinitionType> mainPanel = new MainObjectListPanel<AccessCertificationDefinitionType>(ID_TABLE, AccessCertificationDefinitionType.class, null) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_CERT_DEFINITIONS_PANEL;
}
@Override
protected IColumn<SelectableBean<AccessCertificationDefinitionType>, String> createCheckboxColumn() {
return null;
}
@Override
public void objectDetailsPerformed(AjaxRequestTarget target, AccessCertificationDefinitionType service) {
PageCertDefinitions.this.detailsPerformed(target, service);
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return PageCertDefinitions.this.createInlineMenu();
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation, CompiledObjectCollectionView collectionView) {
navigateToNext(PageCertDefinition.class);
}
};
mainPanel.setOutputMarkupId(true);
mainPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_CERT_DEF_BOX_CSS_CLASSES);
mainForm.add(mainPanel);
}
use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel 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.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class PageMessageTemplates method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<MessageTemplateType> table = new MainObjectListPanel<>(ID_TABLE, MessageTemplateType.class) {
@Override
protected TableId getTableId() {
return TableId.TABLE_MESSAGE_TEMPLATES;
}
@Override
protected IColumn<SelectableBean<MessageTemplateType>, String> createCheckboxColumn() {
return null;
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
Aggregations