/** * 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); }
@Override public Object getValue(ELContext context) { FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location, ccLevel); try { return delegate.getValue(context); } finally { CompositeComponentELUtils.removeCompositeComponentForResolver(facesContext); } }
public TagAttributeImpl(Location location, String ns, String localName, String qName, String value) { boolean literal; boolean compositeComponentExpression; boolean compositeComponentAttrMethodExpression; this.location = location; this.namespace = ns; this.localName = localName; this.qName = qName; this.value = value; try { literal = ELText.isLiteral(this.value); } catch (ELException e) { throw new TagAttributeException(this, e); } compositeComponentExpression = !literal ? CompositeComponentELUtils.isCompositeComponentExpression(this.value) : false; compositeComponentAttrMethodExpression = compositeComponentExpression ? CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(this.value) : false; this.capabilities = (literal ? EL_LITERAL : 0) | (compositeComponentExpression ? EL_CC : 0) | (compositeComponentAttrMethodExpression ? EL_CC_ATTR_ME : 0); }
public ELCacheableTextVariable(ValueExpression ve) { super(ve.getExpressionString()); this.ve = ve; boolean compositeComponentExpression = CompositeComponentELUtils.isCompositeComponentExpression(ve.getExpressionString()); boolean resourceExpression = ResourceELUtils.isResourceExpression(ve.getExpressionString()); this.capabilities = (compositeComponentExpression ? EL_CC : 0) | ( resourceExpression ? EL_RESOURCE : 0); }
CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression( attributeNameValueExpression.getExpressionString());
if (componentLocation != null && componentLocation.getPath().equals(location.getPath()) && (ccLevel == getCCLevel(currentComponent)) ) if (c != null) return lookForCompositeComponentOnStack( facesContext, location, ccLevel, c);
LinkedList<UIComponent> componentStack = getComponentStack(facesContext); if (componentStack != null && !componentStack.isEmpty())
if (c != null) return lookForCompositeComponentOnStack( facesContext, location, c);
CompositeComponentELUtils.isCompositeComponentExpression(this.value) : false; compositeComponentAttrMethodExpression = compositeComponentExpression ? CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(this.value) : false; resourceExpression = !literal ? ResourceELUtils.isResourceExpression(this.value) : false;
public EventHandler (TagConfig tagConfig) { super (tagConfig); listener = getRequiredAttribute("listener"); if (!listener.isLiteral()) { listenerIsCompositeComponentME = CompositeComponentELUtils.isCompositeComponentExpression(listener.getValue()); } else { listenerIsCompositeComponentME = false; } type = getRequiredAttribute("type"); }
if (componentLocation != null && componentLocation.getPath().equals(location.getPath()) && (ccLevel == getCCLevel(currentCompositeComponent)) ) = lookForCompositeComponentOnStack(facesContext, location, ccLevel, currentComponent); if (foundComponentLocation != null && foundComponentLocation.getPath().equals(location.getPath()) && ccLevel == getCCLevel(foundComponent)) if (componentLocation != null && componentLocation.getPath().equals(location.getPath()) && ccLevel == getCCLevel(foundComponent)) if (componentLocation != null && componentLocation.getPath().equals(location.getPath()) && ccLevel == getCCLevel(currentComponent))
LinkedList<UIComponent> componentStack = getComponentStack(facesContext); if (componentStack != null && !componentStack.isEmpty())
= lookForCompositeComponentOnStack(facesContext, location, currentComponent);
@Override public Object getValue(ELContext context) { FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location); try { return delegate.getValue(context); } finally { CompositeComponentELUtils.removeCompositeComponentForResolver(facesContext); } }
public TagAttributeImpl(Location location, String ns, String localName, String qName, String value) { boolean literal; boolean compositeComponentExpression; boolean compositeComponentAttrMethodExpression; boolean resourceExpression; this.location = location; this.namespace = ns; this.localName = localName; this.qName = qName; this.value = value; try { literal = ELText.isLiteral(this.value); } catch (ELException e) { throw new TagAttributeException(this, e); } compositeComponentExpression = !literal ? CompositeComponentELUtils.isCompositeComponentExpression(this.value) : false; compositeComponentAttrMethodExpression = compositeComponentExpression ? CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(this.value) : false; resourceExpression = !literal ? ResourceELUtils.isResourceExpression(this.value) : false; this.capabilities = (literal ? EL_LITERAL : 0) | (compositeComponentExpression ? EL_CC : 0) | (compositeComponentAttrMethodExpression ? EL_CC_ATTR_ME : 0) | ( resourceExpression ? EL_RESOURCE : 0); }
/** * 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); }
@Override public Object getValue(ELContext context) { FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location); try { return delegate.getValue(context); } finally { CompositeComponentELUtils.removeCompositeComponentForResolver(facesContext); } }
/** * 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 Object invoke(ELContext context, Object[] params) { FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location, ccLevel); try { return delegate.invoke(context, params); } finally { CompositeComponentELUtils.removeCompositeComponentForResolver(facesContext); } }
@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"); } }