public void testBroadCast() { ScrollableGridViewEvent event = new ScrollEvent(table, 20, 30); event.setAttribute("attr", "value0"); table.broadcast(event); assertEquals("value0", table.getAttributes().get("attr")); AjaxEvent ajaxEvent = new AjaxEvent(table); String id = AjaxRendererUtils.getAbsoluteId(table); table.broadcast(ajaxEvent); assertTrue(ajaxContext.getAjaxAreasToRender().contains(id)); SortListener1 sortListener = new SortListener1(); table.setSortListener(sortListener); table.broadcast(new SortEvent(table, "0", 20, 30)); assertTrue(sortListener.triggered); }
/** * Looks up the parent naming container for the component source of the action event, and reset * components recursively within this container. * * @since 5.9.1 */ public void resetComponentsFor(ActionEvent event) { UIComponent component = event.getComponent(); if (component == null) { return; } String baseCompId = getBaseComponentId(); if (baseCompId != null) { FacesContext ctx = FacesContext.getCurrentInstance(); UIComponent target = RendererUtils.getInstance().findComponentFor(component, baseCompId); if (target != null) { baseCompId = AjaxRendererUtils.getAbsoluteId(target); } UIComponent anchor = ctx.getViewRoot().findComponent(baseCompId); resetComponentResursive(anchor); } else { log.error("No base component id given => cannot reset " + "components state."); } }