Search in sources :

Example 1 with BreadcrumbPageInstance

use of com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance in project midpoint by Evolveum.

the class AbstractRoleMainPanel method getPreviousPage.

private Class getPreviousPage(PageAdminObjectDetails<R> parentPage) {
    List<Breadcrumb> breadcrumbs = parentPage.getBreadcrumbs();
    if (breadcrumbs == null || breadcrumbs.size() < 2) {
        return null;
    }
    Breadcrumb previousBreadcrumb = breadcrumbs.get(breadcrumbs.size() - 2);
    Class page = null;
    if (previousBreadcrumb instanceof BreadcrumbPageClass) {
        page = ((BreadcrumbPageClass) previousBreadcrumb).getPage();
    } else if (previousBreadcrumb instanceof BreadcrumbPageInstance) {
        page = ((BreadcrumbPageInstance) previousBreadcrumb).getPage().getClass();
    }
    return page;
}
Also used : BreadcrumbPageClass(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb) BreadcrumbPageClass(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass) BreadcrumbPageInstance(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance)

Example 2 with BreadcrumbPageInstance

use of com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance in project midpoint by Evolveum.

the class CaseWorkItemListWithDetailsPanel method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, createStringResource("MultivalueContainerListPanel.cancelButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            setItemDetailsVisible(false);
            cancelItemDetailsPerformed(ajaxRequestTarget);
            ajaxRequestTarget.add(CaseWorkItemListWithDetailsPanel.this);
            ajaxRequestTarget.add(CaseWorkItemListWithDetailsPanel.this.getPageBase().getFeedbackPanel());
        }
    };
    getDetailsPanelContainer().add(cancelButton);
    CaseWorkItemActionsPanel actionsPanel = new CaseWorkItemActionsPanel(ID_CASE_WORK_ITEM_ACTIONS_PANEL, new LoadableModel<>() {

        private static final long serialVersionUID = 1L;

        @Override
        protected CaseWorkItemType load() {
            return getDetailsPanelItemsList().size() > 0 ? getDetailsPanelItemsList().get(0).getRealValue() : null;
        }
    }) {

        private static final long serialVersionUID = 1L;

        @Override
        protected WorkItemDelegationRequestType getDelegationRequest(UserType delegate) {
            return super.getDelegationRequest(delegate).comment(WorkItemTypeUtil.getComment(getModelObject()));
        }

        @Override
        protected Component getCustomForm() {
            return workItemDetails != null ? workItemDetails.getCustomForm() : null;
        }

        @Override
        protected void afterActionFinished(AjaxRequestTarget target) {
            Breadcrumb previousBreadcrumb = getPageBase().getPreviousBreadcrumb();
            if (previousBreadcrumb instanceof BreadcrumbPageInstance && ((BreadcrumbPageInstance) previousBreadcrumb).getPage() instanceof PageCaseWorkItem) {
                getPageBase().redirectBack(3);
            } else {
                getPageBase().redirectBack();
            }
        }
    };
    actionsPanel.setOutputMarkupId(true);
    actionsPanel.add(new VisibleBehaviour(() -> {
        CaseWorkItemType workItemSelected = getDetailsPanelItemsList().size() > 0 ? getDetailsPanelItemsList().get(0).getRealValue() : null;
        return CaseWorkItemUtil.isCaseWorkItemNotClosed(workItemSelected);
    }));
    getDetailsPanelContainer().add(actionsPanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb) BreadcrumbPageInstance(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance)

Example 3 with BreadcrumbPageInstance

use of com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance in project midpoint by Evolveum.

the class PageFocusPreviewChanges method savePerformed.

private void savePerformed(AjaxRequestTarget target) {
    Breadcrumb bc = redirectBack();
    if (bc instanceof BreadcrumbPageInstance) {
        BreadcrumbPageInstance bcpi = (BreadcrumbPageInstance) bc;
        WebPage page = bcpi.getPage();
        if (page instanceof PageFocusDetails) {
            ((PageFocusDetails) page).setSaveOnConfigure(true);
        } else {
            error("Couldn't save changes - unexpected referring page: " + page);
        }
    } else {
        error("Couldn't save changes - no instance for referring page; breadcrumb is " + bc);
    }
}
Also used : WebPage(org.apache.wicket.markup.html.WebPage) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb) BreadcrumbPageInstance(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance)

Example 4 with BreadcrumbPageInstance

use of com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance in project midpoint by Evolveum.

the class PagePreviewChanges method savePerformed.

private void savePerformed(AjaxRequestTarget target) {
    Breadcrumb bc = redirectBack();
    if (bc instanceof BreadcrumbPageInstance) {
        BreadcrumbPageInstance bcpi = (BreadcrumbPageInstance) bc;
        WebPage page = bcpi.getPage();
        if (page instanceof PageAdminObjectDetails) {
            ((PageAdminObjectDetails) page).setSaveOnConfigure(true);
        } else {
            error("Couldn't save changes - unexpected referring page: " + page);
        }
    } else {
        error("Couldn't save changes - no instance for referring page; breadcrumb is " + bc);
    }
}
Also used : WebPage(org.apache.wicket.markup.html.WebPage) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb) BreadcrumbPageInstance(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance) PageAdminObjectDetails(com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails)

Example 5 with BreadcrumbPageInstance

use of com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance in project midpoint by Evolveum.

the class WebComponentUtil method getPreviousPageClass.

public static Class<?> getPreviousPageClass(PageBase parentPage) {
    List<Breadcrumb> breadcrumbs = parentPage.getBreadcrumbs();
    if (breadcrumbs == null || breadcrumbs.size() < 2) {
        return null;
    }
    Breadcrumb previousBreadcrumb = breadcrumbs.get(breadcrumbs.size() - 2);
    Class<?> page = null;
    if (previousBreadcrumb instanceof BreadcrumbPageClass) {
        page = ((BreadcrumbPageClass) previousBreadcrumb).getPage();
    } else if (previousBreadcrumb instanceof BreadcrumbPageInstance) {
        page = ((BreadcrumbPageInstance) previousBreadcrumb).getPage().getClass();
    }
    return page;
}
Also used : BreadcrumbPageClass(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb) BreadcrumbPageInstance(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance)

Aggregations

BreadcrumbPageInstance (com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance)6 Breadcrumb (com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb)5 BreadcrumbPageClass (com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass)2 WebPage (org.apache.wicket.markup.html.WebPage)2 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)1 PageAdminObjectDetails (com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1