Search in sources :

Example 16 with Breadcrumb

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

the class PageRequestRole method createBreadcrumb.

@Override
protected void createBreadcrumb() {
    super.createBreadcrumb();
    Breadcrumb bc = getLastBreadcrumb();
    bc.setIcon(new Model("fa fa-pencil-square-o"));
}
Also used : Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb)

Example 17 with Breadcrumb

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

Example 18 with Breadcrumb

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

the class MainMenuPanel method menuItemPerformed.

private void menuItemPerformed(MenuItem menu) {
    LOGGER.trace("menuItemPerformed: {}", menu);
    // getSession().getSessionStorage().setActiveMenu(menu.getNameModel());
    // getSession().getSessionStorage().setActiveMainMenu(getModelObject().getNameModel());
    IPageFactory pFactory = Session.get().getPageFactory();
    WebPage page;
    if (menu.getParams() == null) {
        page = pFactory.newPage(menu.getPageClass());
    } else {
        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();
    Breadcrumb bc = new Breadcrumb(createStringResource(name));
    bc.setIcon(new Model<>(mainMenuItem.getIconClass()));
    pageBase.addBreadcrumb(bc);
    if (mainMenuItem.containsSubMenu() && mainMenuItem.isInsertDefaultBackBreadcrumb()) {
        MenuItem first = mainMenuItem.getFirstMenuItem();
        BreadcrumbPageClass invisibleBc = new BreadcrumbPageClass(createStringResource(first.getNameModel()), 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 19 with Breadcrumb

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

the class PageDashboard method createBreadcrumb.

@Override
protected void createBreadcrumb() {
    super.createBreadcrumb();
    Breadcrumb bc = getLastBreadcrumb();
    bc.setIcon(new Model(GuiStyleConstants.CLASS_DASHBOARD_ICON));
}
Also used : Model(org.apache.wicket.model.Model) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb)

Example 20 with Breadcrumb

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

the class PageBase method redirectBackToBreadcrumb.

public void redirectBackToBreadcrumb(Breadcrumb breadcrumb) {
    Validate.notNull(breadcrumb, "Breadcrumb must not be null");
    boolean found = false;
    // we remove all breadcrumbs that are after "breadcrumb"
    List<Breadcrumb> breadcrumbs = getBreadcrumbs();
    Iterator<Breadcrumb> iterator = breadcrumbs.iterator();
    while (iterator.hasNext()) {
        Breadcrumb b = iterator.next();
        if (found) {
            iterator.remove();
        } else if (b.equals(breadcrumb)) {
            found = true;
        }
    }
    WebPage page = breadcrumb.redirect();
    if (page instanceof PageBase) {
        PageBase base = (PageBase) page;
        base.setBreadcrumbs(breadcrumbs);
    }
    setResponsePage(page);
}
Also used : WebPage(org.apache.wicket.markup.html.WebPage) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb)

Aggregations

Breadcrumb (com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb)26 Model (org.apache.wicket.model.Model)11 IModel (org.apache.wicket.model.IModel)10 BreadcrumbPageInstance (com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance)5 WebPage (org.apache.wicket.markup.html.WebPage)4 BreadcrumbPageClass (com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass)3 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 UserDetailsModel (com.evolveum.midpoint.gui.impl.page.admin.user.UserDetailsModel)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 PageAdminObjectDetails (com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails)1 PageAssignmentsList (com.evolveum.midpoint.web.page.self.PageAssignmentsList)1 IPageFactory (org.apache.wicket.IPageFactory)1 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)1 TransparentWebMarkupContainer (org.apache.wicket.markup.html.TransparentWebMarkupContainer)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1