Search in sources :

Example 1 with BreadcrumbPageClass

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

the class PageBase method createBreadcrumb.

protected void createBreadcrumb() {
    BreadcrumbPageClass bc = new BreadcrumbPageClass(new AbstractReadOnlyModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            return getPageTitleModel().getObject();
        }
    }, this.getClass(), getPageParameters());
    addBreadcrumb(bc);
}
Also used : BreadcrumbPageClass(com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass)

Example 2 with BreadcrumbPageClass

use of com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass 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 3 with BreadcrumbPageClass

use of com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass 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)

Aggregations

BreadcrumbPageClass (com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass)3 Breadcrumb (com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb)2 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 BreadcrumbPageInstance (com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance)1 IPageFactory (org.apache.wicket.IPageFactory)1 WebPage (org.apache.wicket.markup.html.WebPage)1