compositeParent.pushComponentToEL(context, null); source.pushComponentToEL(context, null); source.broadcast(originalEvent);
compositeParent.pushComponentToEL(ctx, null); source.pushComponentToEL(ctx, null); source.broadcast(target);
public static void includeCompositeComponent(UIComponent parent, String libraryName, String resourceName, String id) { // Prepare. FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY); // This basically creates <ui:component> based on <composite:interface>. Resource resource = application.getResourceHandler().createResource(resourceName, libraryName); UIComponent composite = application.createComponent(context, resource); composite.setId(id); // Mandatory for the case composite is part of UIForm! Otherwise JSF can't find inputs. // This basically creates <composite:implementation>. UIComponent implementation = application.createComponent(UIPanel.COMPONENT_TYPE); implementation.setRendererType("javax.faces.Group"); composite.getFacets().put(UIComponent.COMPOSITE_FACET_NAME, implementation); // Now include the composite component file in the given parent. parent.getChildren().add(composite); parent.pushComponentToEL(context, composite); // This makes #{cc} available. try { faceletContext.includeFacelet(implementation, resource.getURL()); } catch (IOException e) { throw new FacesException(e); } finally { parent.popComponentFromEL(context); } }
private void pushAllComponentsIntoStack(FacesContext facesContext, UIComponent component) { UIComponent parent = component.getParent(); if (parent != null) { pushAllComponentsIntoStack(facesContext, parent); } component.pushComponentToEL(facesContext, component); }
/** * Call {@link UIComponent#pushComponentToEL(javax.faces.context.FacesContext,javax.faces.component.UIComponent)}, * reads the isRendered property, call {@link * UIComponent#popComponentFromEL} and returns the value of isRendered. */ static boolean isRendered(FacesContext facesContext, UIComponent uiComponent) { // We must call pushComponentToEL here because ValueExpression may have // implicit object "component" used. try { uiComponent.pushComponentToEL(facesContext, uiComponent); return uiComponent.isRendered(); } finally { uiComponent.popComponentFromEL(facesContext); } }
/** * Call {@link UIComponent#pushComponentToEL(javax.faces.context.FacesContext,javax.faces.component.UIComponent)}, * reads the isRendered property, call {@link * UIComponent#popComponentFromEL} and returns the value of isRendered. */ static boolean isRendered(FacesContext facesContext, UIComponent uiComponent) { // We must call pushComponentToEL here because ValueExpression may have // implicit object "component" used. try { uiComponent.pushComponentToEL(facesContext, uiComponent); return uiComponent.isRendered(); } finally { uiComponent.popComponentFromEL(facesContext); } }
/** * Call {@link UIComponent#pushComponentToEL(javax.faces.context.FacesContext, javax.faces.component.UIComponent)}, * reads the isRendered property, call {@link * UIComponent#popComponentFromEL(javax.faces.context.FacesContext)} and returns the value of isRendered. */ public static boolean isRendered(FacesContext facesContext, UIComponent uiComponent) { // We must call pushComponentToEL here because ValueExpression may have // implicit object "component" used. try { uiComponent.pushComponentToEL(facesContext, uiComponent); return uiComponent.isRendered(); } finally { uiComponent.popComponentFromEL(facesContext); } }
/** * Call {@link #pushComponentToEL(javax.faces.context.FacesContext,javax.faces.component.UIComponent)}, * reads the isRendered property, call {@link * UIComponent#popComponentFromEL} and returns the value of isRendered. */ public static boolean isRendered(FacesContext facesContext, UIComponent uiComponent) { // We must call pushComponentToEL here because ValueExpression may have // implicit object "component" used. try { uiComponent.pushComponentToEL(facesContext, uiComponent); return uiComponent.isRendered(); } finally { uiComponent.popComponentFromEL(facesContext); } }
protected boolean pushComponentToEL(FaceletContext ctx, UIComponent c, CompositeComponentStackManager ccStackManager) { c.pushComponentToEL(ctx.getFacesContext(), c); boolean compcompPushed = false; if (UIComponent.isCompositeComponent(c)) { compcompPushed = ccStackManager.push(c, TreeCreation); } return compcompPushed; }
protected boolean pushComponentToEL(FaceletContext ctx, UIComponent c, CompositeComponentStackManager ccStackManager) { c.pushComponentToEL(ctx.getFacesContext(), c); boolean compcompPushed = false; if (UIComponent.isCompositeComponent(c)) { compcompPushed = ccStackManager.push(c, TreeCreation); } return compcompPushed; }
/** * If overridden, this method (i.e. super.encodeEnd) should be called * <em>last</em> within the overridding implementation. */ @Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { // Remove the key to prevent issues with state saving... String ccID = (String) component.getAttributes().get(COMP_KEY); if (ccID != null) { // the first pop maps to the component we're rendering. // the second pop maps to the composite component that was pushed // in this renderer's encodeBegin implementation. // re-push the current component to reset the original context component.popComponentFromEL(context); component.popComponentFromEL(context); component.pushComponentToEL(context, component); } }
protected boolean pushComponentToEL(FaceletContext ctx, UIComponent c, CompositeComponentStackManager ccStackManager) { c.pushComponentToEL(ctx.getFacesContext(), c); boolean compcompPushed = false; if (UIComponent.isCompositeComponent(c)) { compcompPushed = ccStackManager.push(c, TreeCreation); } return compcompPushed; }
/** * If overridden, this method (i.e. super.encodeEnd) should be called <em>last</em> within the overridding * implementation. */ @Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { // Remove the key to prevent issues with state saving... String ccID = (String) component.getAttributes().get(COMP_KEY); if (ccID != null) { // the first pop maps to the component we're rendering. // the second pop maps to the composite component that was pushed // in this renderer's encodeBegin implementation. // re-push the current component to reset the original context component.popComponentFromEL(context); component.popComponentFromEL(context); component.pushComponentToEL(context, component); } }
protected boolean pushComponentToEL(FaceletContext ctx, UIComponent c, CompositeComponentStackManager ccStackManager) { c.pushComponentToEL(ctx.getFacesContext(), c); boolean compcompPushed = false; if (UIComponent.isCompositeComponent(c)) { compcompPushed = ccStackManager.push(c, TreeCreation); } return compcompPushed; }
public void encodeEnd(FacesContext context, UIComponent component) throws IOException { String ccID = (String) component.getAttributes().get(COMP_KEY); if (ccID != null) { component.popComponentFromEL(context); component.popComponentFromEL(context); component.pushComponentToEL(context, component); } if (!isScriptExpression(component)) { ResponseWriter writer = context.getResponseWriter(); Map<String,Object> attrs = component.getAttributes(); String qName = (String) attrs.get(FacesDecorator.QNAME); writer.endElement(qName); } }
public void encodeEnd(FacesContext context, UIComponent component) throws IOException { String ccID = (String) component.getAttributes().get(COMP_KEY); if (ccID != null) { component.popComponentFromEL(context); component.popComponentFromEL(context); component.pushComponentToEL(context, component); } if (!isScriptExpression(component)) { ResponseWriter writer = context.getResponseWriter(); Map<String,Object> attrs = component.getAttributes(); String qName = (String) attrs.get(FacesDecorator.QNAME); writer.endElement(qName); } }
private static void publishAfterViewEvents(FacesContext context, Application application, UIComponent component) { component.setInView(true); try { component.pushComponentToEL(context, component); application.publishEvent(context, PostAddToViewEvent.class, component); if (component.getChildCount() > 0) { Collection<UIComponent> clist = new ArrayList<>(component.getChildren()); for (UIComponent c : clist) { publishAfterViewEvents(context, application, c); } } if (component.getFacetCount() > 0) { Collection<UIComponent> clist = new ArrayList<>(component.getFacets().values()); for (UIComponent c : clist) { publishAfterViewEvents(context, application, c); } } } finally { component.popComponentFromEL(context); } }
public static void broadcast(FacesContext context, RowKeyFacesEvent rowKeyFacesEvent) throws AbortProcessingException { final UIDataAdaptor dataAdaptor = rowKeyFacesEvent.getComponent(); final UIComponent targetComponent = rowKeyFacesEvent.getFacesEvent().getComponent(); final UIComponent compositeParent = getCompositeParent(targetComponent); try { if (compositeParent != null) { compositeParent.pushComponentToEL(context, null); } targetComponent.pushComponentToEL(context, null); dataAdaptor.setRowKey(context, rowKeyFacesEvent.getEventRowKey()); targetComponent.broadcast(rowKeyFacesEvent.getFacesEvent()); } finally { dataAdaptor.setRowKey(context, dataAdaptor.getRowKey()); targetComponent.popComponentFromEL(context); if (compositeParent != null) { compositeParent.popComponentFromEL(context); } } }
public static void broadcast(FacesContext context, RowKeyFacesEvent rowKeyFacesEvent) throws AbortProcessingException { final UIDataAdaptor dataAdaptor = rowKeyFacesEvent.getComponent(); final UIComponent targetComponent = rowKeyFacesEvent.getFacesEvent().getComponent(); final UIComponent compositeParent = getCompositeParent(targetComponent); try { if (compositeParent != null) { compositeParent.pushComponentToEL(context, null); } targetComponent.pushComponentToEL(context, null); dataAdaptor.setRowKey(context, rowKeyFacesEvent.getEventRowKey()); targetComponent.broadcast(rowKeyFacesEvent.getFacesEvent()); } finally { dataAdaptor.setRowKey(context, dataAdaptor.getRowKey()); targetComponent.popComponentFromEL(context); if (compositeParent != null) { compositeParent.popComponentFromEL(context); } } }
public static void broadcast(FacesContext context, RowKeyFacesEvent rowKeyFacesEvent) throws AbortProcessingException { final UIDataAdaptor dataAdaptor = rowKeyFacesEvent.getComponent(); final UIComponent targetComponent = rowKeyFacesEvent.getFacesEvent().getComponent(); final UIComponent compositeParent = getCompositeParent(targetComponent); try { if (compositeParent != null) { compositeParent.pushComponentToEL(context, null); } targetComponent.pushComponentToEL(context, null); dataAdaptor.setRowKey(context, rowKeyFacesEvent.getEventRowKey()); targetComponent.broadcast(rowKeyFacesEvent.getFacesEvent()); } finally { dataAdaptor.setRowKey(context, dataAdaptor.getRowKey()); targetComponent.popComponentFromEL(context); if (compositeParent != null) { compositeParent.popComponentFromEL(context); } } }