List of usage examples for org.apache.wicket.extensions.breadcrumb IBreadCrumbParticipant IBreadCrumbParticipant
IBreadCrumbParticipant
From source file:com.doculibre.constellio.wicket.panels.admin.tabs.AdminLeftMenuPanel.java
License:Open Source License
private void setBreadCrumbs() { AdminTopMenuPanel topMenuPanel = (AdminTopMenuPanel) findParent(AdminTopMenuPanel.class); BreadCrumbBar breadCrumbBar = topMenuPanel.getBreadCrumbBar(); int breadCrumbCount = breadCrumbBar.allBreadCrumbParticipants().size(); if (breadCrumbCount == 2) { breadCrumbBar.allBreadCrumbParticipants().remove(1); }/*w w w .j a va2 s .co m*/ breadCrumbBar.setActive(new IBreadCrumbParticipant() { @Override public void onActivate(IBreadCrumbParticipant previous) { // Nothing to do } @Override public String getTitle() { int selectedTab = getSelectedTab(); if (selectedTab == -1) { selectedTab = 0; } ITab leftMenuTab = (ITab) getTabs().get(selectedTab); String leftMenuTitle = leftMenuTab.getTitle().getObject().toString(); AdminTopMenuPanel adminTopMenuPanel = (AdminTopMenuPanel) findParent(AdminTopMenuPanel.class); if (adminTopMenuPanel.getSelectedTab() == 0) { Component currentTabContent = adminTopMenuPanel.get(TAB_PANEL_ID); if (currentTabContent instanceof AdminCollectionPanel) { AdminCollectionPanel adminCollectionPanel = (AdminCollectionPanel) currentTabContent; RecordCollection collection = adminCollectionPanel.getCollection(); Locale displayLocale = collection.getDisplayLocale(getLocale()); String collectionTitle = collection.getTitle(displayLocale); leftMenuTitle = collectionTitle + " > " + leftMenuTitle; } } return leftMenuTitle; } @Override public Component getComponent() { return get(TabbedPanel.TAB_PANEL_ID); } }); }
From source file:com.doculibre.constellio.wicket.panels.admin.tabs.AdminTopMenuPanel.java
License:Open Source License
private void setBreadCrumbs() { breadCrumbBar.allBreadCrumbParticipants().clear(); breadCrumbBar.setActive(new IBreadCrumbParticipant() { @Override//from w ww. j a v a2 s .c o m public void onActivate(IBreadCrumbParticipant previous) { Component currentTabContent = get(TAB_PANEL_ID); if (currentTabContent instanceof AdminCollectionPanel) { TabbedPanel subTabPanel = (TabbedPanel) currentTabContent; int tab = subTabPanel.getSelectedTab(); // If the selected tab is -1, it means the panel has been // created within the same request. The user has just // selected a collection and we don't want to return to // collection's list page if (tab != -1) { setSelectedTab(0); } } else if (currentTabContent instanceof TabbedPanel) { TabbedPanel subTabPanel = (TabbedPanel) currentTabContent; subTabPanel.setSelectedTab(0); } } @Override public String getTitle() { int selectedTab = getSelectedTab(); if (selectedTab == -1) { selectedTab = 0; } ITab topMenuTab = (ITab) getTabs().get(selectedTab); String title = topMenuTab.getTitle().getObject().toString(); return title; } @Override public Component getComponent() { Component currentTabContent = get(TAB_PANEL_ID); return currentTabContent; } }); }