private AbstractPanelMenuGroup getTopGroup() { AbstractPanelMenuGroup c = this; while (c.getParent() instanceof AbstractPanelMenuGroup) { c = (AbstractPanelMenuGroup) c.getParent(); } return c; }
private void collapseOtherTopGroups() { UIComponent topGroup = getTopGroup(); for (UIComponent child : getPanelMenu().getChildren()) { if (!(child instanceof AbstractPanelMenuGroup)) { continue; } AbstractPanelMenuGroup group = (AbstractPanelMenuGroup) child; if (group == topGroup) { continue; } group.setSubmittedExpanded(null); group.setExpanded(false); } }
public boolean hasActiveItem(UIComponent component, String activeItem) { if (activeItem == null) { return false; } if (component instanceof AbstractPanelMenuItem) { AbstractPanelMenuItem item = (AbstractPanelMenuItem) component; if (activeItem.equals(item.getName())) { return true; } } if (component instanceof AbstractPanelMenuGroup) { AbstractPanelMenuGroup group = (AbstractPanelMenuGroup) component; if (!group.getPanelMenu().isBubbleSelection()) { return false; } } if (component.getChildCount() > 0) { for (UIComponent child : component.getChildren()) { if (!child.isRendered()) { continue; } if (!(child instanceof AbstractPanelMenuItem)) { continue; } if (hasActiveItem(child, activeItem)) { return true; } } } return false; }