Search in sources :

Example 6 with PageBase

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

the class NameStep method discoverConnectors.

private void discoverConnectors(ConnectorHostType host) {
    PageBase page = (PageBase) getPage();
    Task task = page.createSimpleTask(OPERATION_DISCOVER_CONNECTORS);
    OperationResult result = task.getResult();
    try {
        ModelService model = page.getModelService();
        model.discoverConnectors(host, task, result);
    } catch (CommonException | RuntimeException ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't discover connectors", ex);
    } finally {
        result.recomputeStatus();
    }
    if (WebComponentUtil.showResultInPage(result)) {
        page.showResult(result);
    }
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CommonException(com.evolveum.midpoint.util.exception.CommonException) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) ModelService(com.evolveum.midpoint.model.api.ModelService)

Example 7 with PageBase

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

the class MultipleAssignmentSelectorPanel method getAssignableRolesFilter.

private ObjectFilter getAssignableRolesFilter() {
    LOGGER.debug("Loading roles which the current user has right to assign");
    OperationResult result = new OperationResult(OPERATION_LOAD_ASSIGNABLE_ROLES);
    ObjectFilter filter = null;
    try {
        PageBase pb = getPageBase();
        ModelInteractionService mis = pb.getModelInteractionService();
        RoleSelectionSpecification roleSpec = mis.getAssignableRoleSpecification(focus, result);
        filter = roleSpec.getFilter();
    } catch (Exception ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load available roles", ex);
        result.recordFatalError("Couldn't load available roles", ex);
    } finally {
        result.recomputeStatus();
    }
    if (!result.isSuccess() && !result.isHandledError()) {
        getPageBase().showResult(result);
    }
    return filter;
}
Also used : ModelInteractionService(com.evolveum.midpoint.model.api.ModelInteractionService) RoleSelectionSpecification(com.evolveum.midpoint.model.api.RoleSelectionSpecification) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 8 with PageBase

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

the class TablePanel method initLayout.

private void initLayout(List<IColumn<T, String>> columns, ISortableDataProvider provider, long pageSize) {
    DataTable<T, String> table = new SelectableDataTable<>(ID_TABLE, columns, provider, (int) pageSize);
    table.setOutputMarkupId(true);
    TableHeadersToolbar headers = new TableHeadersToolbar(table, provider);
    headers.setOutputMarkupId(true);
    table.addTopToolbar(headers);
    CountToolbar count = new CountToolbar(table) {

        @Override
        protected void pageSizeChanged(AjaxRequestTarget target) {
            PageBase page = (PageBase) getPage();
            Integer pageSize = page.getSessionStorage().getUserProfile().getPagingSize(tableId);
            setItemsPerPage(pageSize);
            target.add(getNavigatorPanel());
            target.add(getDataTable());
        }

        @Override
        protected boolean isPageSizePopupVisible() {
            return tableId != null;
        }
    };
    addVisibleBehaviour(count, showCount);
    table.addBottomToolbar(count);
    add(table);
    NavigatorPanel nb2 = new NavigatorPanel(ID_PAGING, table, showPagedPagingModel(provider));
    addVisibleBehaviour(nb2, showPaging);
    add(nb2);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) NavigatorPanel(com.evolveum.midpoint.web.component.data.paging.NavigatorPanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 9 with PageBase

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

the class AsyncDashboardPanel method onPostSuccess.

@Override
protected void onPostSuccess(AjaxRequestTarget target) {
    WebMarkupContainer dashboardContent = getDashboardContent();
    dashboardContent.replace(getMainComponent(ID_CONTENT));
    PageBase page = (PageBase) getPage();
    showResultIfError(page);
    target.add(this, page.getFeedbackPanel());
}
Also used : PageBase(com.evolveum.midpoint.gui.api.page.PageBase) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 10 with PageBase

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

the class PageReport method createFullXmlValidator.

private IValidator<String> createFullXmlValidator() {
    return new IValidator<String>() {

        @Override
        public void validate(IValidatable<String> validatable) {
            String value = validatable.getValue();
            OperationResult result = new OperationResult(OPERATION_VALIDATE_REPORT);
            Holder<PrismObject<ReportType>> reportHolder = new Holder<>(null);
            OpResult opResult = null;
            try {
                validateObject(value, reportHolder, PrismContext.LANG_XML, true, result);
                if (!result.isAcceptable()) {
                    result.recordFatalError("Could not validate object", result.getCause());
                    opResult = OpResult.getOpResult((PageBase) getPage(), result);
                    validatable.error(new RawValidationError(opResult));
                }
            } catch (Exception e) {
                LOGGER.error("Validation problem occured." + e.getMessage());
                result.recordFatalError("Could not validate object.", e);
                try {
                    opResult = OpResult.getOpResult((PageBase) getPage(), result);
                    validatable.error(new RawValidationError(opResult));
                } catch (Exception ex) {
                    error(ex);
                }
            }
        }
    };
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) IValidator(org.apache.wicket.validation.IValidator) Holder(com.evolveum.midpoint.util.Holder) OpResult(com.evolveum.midpoint.gui.api.component.result.OpResult) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) RawValidationError(org.apache.wicket.validation.RawValidationError) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RestartResponseException(org.apache.wicket.RestartResponseException) IValidatable(org.apache.wicket.validation.IValidatable)

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