Search in sources :

Example 21 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class ObjectSelectionPanel method createObjectQuery.

private ObjectQuery createObjectQuery() {
    ObjectSearchDto dto = searchModel.getObject();
    ObjectQuery query = null;
    if (StringUtils.isEmpty(dto.getText())) {
        if (context.getDataProviderQuery() != null) {
            return context.getDataProviderQuery();
        } else {
            return query;
        }
    }
    try {
        PageBase pageBase = WebComponentUtil.getPageBase(this);
        PrismContext prismContext = pageBase.getPrismContext();
        PolyStringNormalizer normalizer = prismContext.getDefaultPolyStringNormalizer();
        String normalized = normalizer.normalize(dto.getText());
        ObjectFilter filter = QueryBuilder.queryFor(objectType, prismContext).item(context.getSearchProperty()).contains(normalized).matchingNorm().buildFilter();
        if (context.getDataProviderQuery() != null) {
            AndFilter and = AndFilter.createAnd(context.getDataProviderQuery().getFilter(), filter);
            query = ObjectQuery.createObjectQuery(and);
        } else {
            query = ObjectQuery.createObjectQuery(filter);
        }
    } catch (Exception e) {
        error(getString("chooseTypeDialog.message.queryError") + " " + e.getMessage());
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't create query filter.", e);
    }
    return query;
}
Also used : AndFilter(com.evolveum.midpoint.prism.query.AndFilter) ObjectSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectSearchDto) PrismContext(com.evolveum.midpoint.prism.PrismContext) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) PolyStringNormalizer(com.evolveum.midpoint.prism.polystring.PolyStringNormalizer)

Example 22 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class MainMenuPanel method menuItemPerformed.

private void menuItemPerformed(MenuItem menu) {
    LOGGER.trace("menuItemPerformed: {}", menu);
    IPageFactory pFactory = Session.get().getPageFactory();
    WebPage page = pFactory.newPage(menu.getPageClass(), menu.getParams());
    if (!(page instanceof PageBase)) {
        setResponsePage(page);
        return;
    }
    PageBase pageBase = (PageBase) page;
    // IMPORTANT: we need to re-bundle the name to a new models
    // that will not be connected to the old page reference
    // otherwise the old page will somehow remain in the memory
    // I have no idea how it could do that and especially how
    // several old pages can remain in memory. But if the model
    // is not re-bundled here then the page size grows and never
    // falls.
    MainMenuItem mainMenuItem = getModelObject();
    String name = mainMenuItem.getNameModel().getObject();
    Breadcrumb bc = new Breadcrumb(new Model<>(name));
    bc.setIcon(new Model<>(mainMenuItem.getIconClass()));
    pageBase.addBreadcrumb(bc);
    List<MenuItem> items = mainMenuItem.getItems();
    if (!items.isEmpty() && mainMenuItem.isInsertDefaultBackBreadcrumb()) {
        MenuItem first = items.get(0);
        IModel<String> nameModel = first.getNameModel();
        BreadcrumbPageClass invisibleBc = new BreadcrumbPageClass(new Model<>(nameModel.getObject()), first.getPageClass(), first.getParams());
        invisibleBc.setVisible(false);
        pageBase.addBreadcrumb(invisibleBc);
    }
    setResponsePage(page);
}
Also used : WebPage(org.apache.wicket.markup.html.WebPage) IPageFactory(org.apache.wicket.IPageFactory) BreadcrumbPageClass(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 23 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class PageTasks method createTaskNameColumn.

// used in SubtasksPanel as well
public static IColumn createTaskNameColumn(final Component component, String label) {
    LinkColumn<TaskDto> column = new LinkColumn<TaskDto>(createStringResourceStatic(component, label), TaskDto.F_NAME, TaskDto.F_NAME) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<TaskDto> rowModel) {
            TaskDto task = rowModel.getObject();
            taskDetailsPerformed(target, task.getOid());
        }

        private void taskDetailsPerformed(AjaxRequestTarget target, String oid) {
            PageParameters parameters = new PageParameters();
            parameters.add(OnePageParameterEncoder.PARAMETER, oid);
            PageBase page = (PageBase) component.getPage();
            page.navigateToNext(PageTaskEdit.class, parameters);
        }

        @Override
        public boolean isEnabled(IModel<TaskDto> rowModel) {
            return super.isEnabled(rowModel) && rowModel.getObject().getOid() != null;
        }
    };
    return column;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 24 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class ResourceContentPanel method deleteResourceObjectPerformed.

// TODO: as a task?
protected void deleteResourceObjectPerformed(ShadowType selected, AjaxRequestTarget target) {
    final List<ShadowType> selectedShadow = getSelectedShadowsList(selected);
    final OperationResult result = new OperationResult(OPERATION_DELETE_OBJECT);
    if (selectedShadow == null || selectedShadow.isEmpty()) {
        result.recordWarning("Nothing selected to delete");
        getPageBase().showResult(result);
        target.add(getPageBase().getFeedbackPanel());
        return;
    }
    ConfirmationPanel dialog = new ConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), createDeleteConfirmString(selected, "pageContentAccounts.message.deleteConfirmation", "pageContentAccounts.message.deleteConfirmationSingle")) {

        @Override
        public void yesPerformed(AjaxRequestTarget target) {
            ((PageBase) getPage()).hideMainPopup(target);
            deleteAccountConfirmedPerformed(target, result, selectedShadow);
        }
    };
    ((PageBase) getPage()).showMainPopup(dialog, target);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfirmationPanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 25 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method taskDetailsPerformed.

private void taskDetailsPerformed(AjaxRequestTarget target, String taskOid) {
    PageParameters parameters = new PageParameters();
    parameters.add(OnePageParameterEncoder.PARAMETER, taskOid);
    ((PageBase) getPage()).navigateToNext(PageTaskEdit.class, parameters);
}
Also used : PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Aggregations

PageBase (com.evolveum.midpoint.gui.api.page.PageBase)44 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)16 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)13 Task (com.evolveum.midpoint.task.api.Task)9 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)7 SystemException (com.evolveum.midpoint.util.exception.SystemException)6 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)5 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 ModelService (com.evolveum.midpoint.model.api.ModelService)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)4 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)4 ConfirmationPanel (com.evolveum.midpoint.web.component.dialog.ConfirmationPanel)4 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)4 PrismContext (com.evolveum.midpoint.prism.PrismContext)3 EncryptionException (com.evolveum.midpoint.prism.crypto.EncryptionException)3 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)3 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 RestartResponseException (org.apache.wicket.RestartResponseException)3