Search in sources :

Example 1 with MainObjectListPanel

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);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) ListDataProvider2(com.evolveum.midpoint.web.component.util.ListDataProvider2) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 2 with MainObjectListPanel

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);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) IModel(org.apache.wicket.model.IModel) InlineMenuHeaderColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn) ArrayList(java.util.ArrayList) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 3 with MainObjectListPanel

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);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) AccessCertificationDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationDefinitionType) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 4 with MainObjectListPanel

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);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) IModel(org.apache.wicket.model.IModel) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) ArrayList(java.util.ArrayList) List(java.util.List) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 5 with MainObjectListPanel

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);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) MessageTemplateType(com.evolveum.midpoint.xml.ns._public.common.common_3.MessageTemplateType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm)

Aggregations

MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)26 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)24 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)22 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)18 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)15 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)14 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)14 ArrayList (java.util.ArrayList)14 Form (org.apache.wicket.markup.html.form.Form)14 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)12 IModel (org.apache.wicket.model.IModel)9 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)5 CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)5 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)5 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)4 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)4 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)3 ColumnMenuAction (com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)3 FocusListInlineMenuHelper (com.evolveum.midpoint.web.component.util.FocusListInlineMenuHelper)3