Search in sources :

Example 6 with ObjectDataProvider

use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.

the class ObjectSelectionPanel method searchPerformed.

private void searchPerformed(AjaxRequestTarget target) {
    ObjectQuery query = createObjectQuery();
    TablePanel panel = getTablePanel();
    DataTable table = panel.getDataTable();
    ObjectDataProvider provider = (ObjectDataProvider) table.getDataProvider();
    provider.setQuery(query);
    target.add(panel);
}
Also used : DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 7 with ObjectDataProvider

use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.

the class ObjectSelectionPanel method clearSearchPerformed.

private void clearSearchPerformed(AjaxRequestTarget target) {
    searchModel.setObject(new ObjectSearchDto());
    TablePanel panel = getTablePanel();
    DataTable table = panel.getDataTable();
    ObjectDataProvider provider = (ObjectDataProvider) table.getDataProvider();
    if (context.getDataProviderQuery() != null) {
        provider.setQuery(context.getDataProviderQuery());
    } else {
        provider.setQuery(null);
    }
    target.add(panel, getSearchForm());
}
Also used : DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) ObjectSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 8 with ObjectDataProvider

use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.

the class ObjectSelectionPanel method initLayout.

public void initLayout(PageBase pageBase) {
    Form searchForm = new Form(ID_SEARCH_FORM);
    searchForm.setOutputMarkupId(true);
    add(searchForm);
    searchForm.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return context.isSearchEnabled();
        }
    });
    BasicSearchPanel<ObjectSearchDto> basicSearch = new BasicSearchPanel<ObjectSearchDto>(ID_BASIC_SEARCH) {

        @Override
        protected IModel<String> createSearchTextModel() {
            return new PropertyModel<>(searchModel, ObjectSearchDto.F_SEARCH_TEXT);
        }

        @Override
        protected void searchPerformed(AjaxRequestTarget target) {
            ObjectSelectionPanel.this.searchPerformed(target);
        }

        @Override
        protected void clearSearchPerformed(AjaxRequestTarget target) {
            ObjectSelectionPanel.this.clearSearchPerformed(target);
        }
    };
    searchForm.add(basicSearch);
    add(context.createExtraContentContainer(ID_EXTRA_CONTENT_CONTAINER, this));
    List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
    ObjectDataProvider provider = new ObjectDataProvider(pageBase, this.objectType);
    provider.setQuery(context.getDataProviderQuery());
    provider.setOptions(context.getDataProviderOptions());
    TablePanel table = new TablePanel<>(ID_TABLE, provider, columns);
    table.setOutputMarkupId(true);
    addOrReplace(table);
    AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("chooseTypeDialog.button.cancel")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            modalWindow.close(ajaxRequestTarget);
        }
    };
    add(cancelButton);
}
Also used : ObjectSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto) Form(org.apache.wicket.markup.html.form.Form) PropertyModel(org.apache.wicket.model.PropertyModel) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) BasicSearchPanel(com.evolveum.midpoint.web.component.BasicSearchPanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 9 with ObjectDataProvider

use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.

the class AbstractShoppingCartTabPanel method getTabPanelProvider.

private ObjectDataProvider<AssignmentEditorDto, AbstractRoleType> getTabPanelProvider() {
    IModel<Search<AbstractRoleType>> searchModel = new IModel<Search<AbstractRoleType>>() {

        @Override
        public Search<AbstractRoleType> getObject() {
            return getRoleCatalogStorage().getSearch();
        }
    };
    ObjectDataProvider provider = new ObjectDataProvider<AssignmentEditorDto, AbstractRoleType>(AbstractShoppingCartTabPanel.this, searchModel) {

        private static final long serialVersionUID = 1L;

        @Override
        public AssignmentEditorDto createDataObjectWrapper(PrismObject<AbstractRoleType> obj) {
            AssignmentEditorDto dto = AssignmentEditorDto.createDtoFromObject(obj.asObjectable(), UserDtoStatus.ADD, getPageBase());
            if (!getRoleCatalogStorage().isMultiUserRequest()) {
                dto.setAlreadyAssigned(isAlreadyAssigned(obj, dto));
                dto.setDefaultAssignmentConstraints(roleManagementConfig == null ? null : roleManagementConfig.getDefaultAssignmentConstraints());
            }
            dto.setSimpleView(true);
            return dto;
        }

        @Override
        protected ObjectQuery getCustomizeContentQuery() {
            return createContentQuery();
        }
    };
    // searchModel.getObject().setTypeClass(getQueryClass());
    return provider;
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) IModel(org.apache.wicket.model.IModel) Search(com.evolveum.midpoint.web.component.search.Search) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider)

Example 10 with ObjectDataProvider

use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.

the class AbstractShoppingCartTabPanel method initButtonsPanel.

private void initButtonsPanel(WebMarkupContainer parametersPanel) {
    AjaxButton addAllButton = new AjaxButton(ID_ADD_ALL_BUTTON, createStringResource("AbstractShoppingCartTabPanel.addAllButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            AbstractShoppingCartTabPanel.this.addAllAssignmentsPerformed(ajaxRequestTarget);
        }
    };
    addAllButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            ObjectDataProvider provider = getGridViewComponent().getProvider();
            return provider != null && provider.size() > 0;
        }

        @Override
        public boolean isEnabled() {
            int assignmentsLimit = AssignmentsUtil.loadAssignmentsLimit(new OperationResult(OPERATION_LOAD_ASSIGNMENTS_LIMIT), AbstractShoppingCartTabPanel.this.getPageBase());
            return !AssignmentsUtil.isShoppingCartAssignmentsLimitReached(assignmentsLimit, AbstractShoppingCartTabPanel.this.getPageBase());
        }
    });
    addAllButton.add(AttributeAppender.append("title", AssignmentsUtil.getShoppingCartAssignmentsLimitReachedTitleModel(getPageBase())));
    parametersPanel.add(addAllButton);
    AjaxButton goToShoppingCartButton = new AjaxButton(ID_GO_TO_SHOPPING_CART_BUTTON, createStringResource("AbstractShoppingCartTabPanel.goToShoppingCartButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            AbstractShoppingCartTabPanel.this.getPageBase().navigateToNext(new PageAssignmentsList(true));
        }
    };
    goToShoppingCartButton.setOutputMarkupId(true);
    goToShoppingCartButton.add(new VisibleBehaviour(() -> {
        boolean isShoppingCartEmpty = AbstractShoppingCartTabPanel.this.getRoleCatalogStorage().getAssignmentShoppingCart().size() == 0;
        return !isShoppingCartEmpty;
    }));
    parametersPanel.add(goToShoppingCartButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider)

Aggregations

ObjectDataProvider (com.evolveum.midpoint.web.component.data.ObjectDataProvider)23 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)13 DataTable (org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable)12 Table (com.evolveum.midpoint.web.component.data.Table)5 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)5 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)4 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)4 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)4 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ObjectSearchDto (com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto)2 ConfigurationStorage (com.evolveum.midpoint.web.session.ConfigurationStorage)2 ReportsStorage (com.evolveum.midpoint.web.session.ReportsStorage)2 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)2 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)2 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)2 Form (org.apache.wicket.markup.html.form.Form)2 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 Task (com.evolveum.midpoint.task.api.Task)1 AjaxDownloadBehaviorFromFile (com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromFile)1