/** * Trys to get the composite component using getCompositeComponentBasedOnLocation() * and saves it in an attribute on the FacesContext, which is then used by * CompositeComponentImplicitObject. * @param facesContext * @param location */ public static void saveCompositeComponentForResolver(FacesContext facesContext, Location location) { UIComponent cc = getCompositeComponentBasedOnLocation(facesContext, location); facesContext.getAttributes().put(CURRENT_COMPOSITE_COMPONENT_KEY, cc); }
/** * Trys to get the composite component using getCompositeComponentBasedOnLocation() * and saves it in an attribute on the FacesContext, which is then used by * CompositeComponentImplicitObject. * @param facesContext * @param location */ public static void saveCompositeComponentForResolver(FacesContext facesContext, Location location) { UIComponent cc = getCompositeComponentBasedOnLocation(facesContext, location); facesContext.getAttributes().put(CURRENT_COMPOSITE_COMPONENT_KEY, cc); }
/** * Trys to get the composite component using getCompositeComponentBasedOnLocation() * and saves it in an attribute on the FacesContext, which is then used by * CompositeComponentImplicitObject. * @param facesContext * @param location */ public static void saveCompositeComponentForResolver(FacesContext facesContext, Location location, int ccLevel) { UIComponent cc = ccLevel > 0 ? getCompositeComponentBasedOnLocation(facesContext, location, ccLevel) : getCompositeComponentBasedOnLocation(facesContext, location); List<UIComponent> list = (List<UIComponent>) facesContext.getAttributes().get(CURRENT_COMPOSITE_COMPONENT_KEY); if (list == null) { list = new ArrayList<UIComponent>(); facesContext.getAttributes().put(CURRENT_COMPOSITE_COMPONENT_KEY, list); } list.add(cc); }
@Override public void processEvent(ComponentSystemEvent event) { if (event instanceof PostAddToViewEvent) { UIComponent component = event.getComponent(); FacesContext facesContext = FacesContext.getCurrentInstance(); Location location = (Location) component.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY); if (location != null) { UIComponent ccParent = CompositeComponentELUtils.getCompositeComponentBasedOnLocation(facesContext, location); if (ccParent != null) { component.getAttributes().put( CompositeComponentELUtils.CC_FIND_COMPONENT_EXPRESSION, ComponentSupport.getFindComponentExpression(facesContext, ccParent)); } } facesContext.getViewRoot().addComponentResource(facesContext, component, "head"); } }
if (topCompositeComponentReference != null) contextComponent = CompositeComponentELUtils.getCompositeComponentBasedOnLocation( faces, event.getComponent(), topCompositeComponentReference); if (contextComponent == null)
if (topCompositeComponentReference != null) contextComponent = CompositeComponentELUtils.getCompositeComponentBasedOnLocation( faces, event.getComponent(), topCompositeComponentReference); if (contextComponent == null)
UIComponent cc = CompositeComponentELUtils.getCompositeComponentBasedOnLocation(facesContext, location); Resource ccResource = (Resource) cc.getAttributes().get(Resource.COMPONENT_RESOURCE_KEY); libraryName = ccResource.getLibraryName();
= CompositeComponentELUtils.getCompositeComponentBasedOnLocation(facesContext, location); if (ccParent != null)
getCompositeComponentBasedOnLocation(facesContext, location); Resource ccResource = (Resource) cc.getAttributes().get( Resource.COMPONENT_RESOURCE_KEY);