public static void addComponentResource(FacesContext context, String name, String library, String target) { Application application = context.getApplication(); UIComponent componentResource = application.createComponent(UIOutput.COMPONENT_TYPE); componentResource.setRendererType(application.getResourceHandler().getRendererTypeForResourceName(name)); componentResource.getAttributes().put("name", name); componentResource.getAttributes().put("library", library); componentResource.getAttributes().put("target", target); context.getViewRoot().addComponentResource(context, componentResource, 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); } }
/** * @see javax.faces.component.UIComponent#setRendererType(java.lang.String) */ @Override public void setRendererType(String rendererType) { parent.setRendererType(rendererType); }
/** * @see javax.faces.component.UIComponent#setRendererType(java.lang.String) */ @Override public void setRendererType(String rendererType) { parent.setRendererType(rendererType); }
/** * @see javax.faces.component.UIComponent#setRendererType(java.lang.String) */ public void setRendererType(String rendererType) { parent.setRendererType(rendererType); }
public void setRendererType(String rendererType) { _delegate.setRendererType(rendererType); }
public void setRendererType(String rendererType) { _delegate.setRendererType(rendererType); }
/** * @see javax.faces.component.UIComponent#setRendererType(java.lang.String) */ @Override public void setRendererType(String rendererType) { parent.setRendererType(rendererType); }
public void setRendererType(String rendererType) { _delegate.setRendererType(rendererType); }
protected void assignUniqueId(FaceletContext ctx, UIComponent parent, String id, UIComponent c) { String uniqueId = createUniqueId(ctx, parent, id); if (uniqueId != null) { c.setId(uniqueId); } if (this.rendererType != null) { c.setRendererType(this.rendererType); } }
public static UIComponent createComponent( final FacesContext facesContext, final String componentType, final RendererTypes rendererType, final String clientId) { final UIComponent component = facesContext.getApplication().createComponent(componentType); if (rendererType != null) { component.setRendererType(rendererType.name()); } component.setId(clientId); return component; }
private UIComponent createComponentResource(FacesContext context) { Application application = context.getApplication(); // renderkit id is not set on FacesContext at this point, so calling // application.createComponent(context, componentType, rendererType) causes NPE UIComponent resourceComponent = application.createComponent(UIOutput.COMPONENT_TYPE); String rendererType = application.getResourceHandler().getRendererTypeForResourceName(BOTH_SKINNING); resourceComponent.setRendererType(rendererType); return resourceComponent; }
public static void addComponentResource(FacesContext context, String name, String library, String target) { Application application = context.getApplication(); UIComponent componentResource = application.createComponent(UIOutput.COMPONENT_TYPE); componentResource.setRendererType(application.getResourceHandler().getRendererTypeForResourceName(name)); componentResource.getAttributes().put("name", name); componentResource.getAttributes().put("library", library); componentResource.getAttributes().put("target", target); context.getViewRoot().addComponentResource(context, componentResource, target); }
public void setRendererType(String rendererType) { setupPerspective(); innerGetDelegate().setRendererType(rendererType); teardownPerspective(); }
protected void setProperties(final UIComponent component) { if (rendered != null) { if (isValueReference(rendered)) { component.setValueBinding("rendered", ValueBindingUtil .createValueBinding(context, rendered)); } else { component.setRendered(Boolean.valueOf(rendered).booleanValue()); } } if (getRendererType() != null) { component.setRendererType(getRendererType()); } }
private void setRenderTypes(final UIComponent component) throws IOException { for (final UIComponent child : component.getChildren()) { if (child.isRendered()) { if (child instanceof AbstractUIForm) { setRenderTypes(child); } else if (child instanceof AbstractUILinks) { child.setRendererType(RendererTypes.LinksInsideBar.name()); } } } }
/** * @param component {@inheritDoc} */ protected void setProperties(UIComponent component) { // The "id" property is explicitly set when components are created // so it does not need to be set here if (rendered != null) { if (isValueReference(rendered)) { ValueBinding vb = getFacesContext().getApplication().createValueBinding(rendered); component.setValueBinding("rendered", vb); } else { component.setRendered(Boolean.valueOf(rendered).booleanValue()); } } if (getRendererType() != null) { component.setRendererType(getRendererType()); } }
@Override public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException { for (final UIComponent child : component.getChildren()) { if (child.isRendered()) { if (child instanceof AbstractUIButton) { child.setRendererType(RendererTypes.ButtonInsideButtons.name()); child.encodeAll(facesContext); } else if (child instanceof AbstractUIBadge) { child.setRendererType(RendererTypes.BadgeInsideButtons.name()); child.encodeAll(facesContext); } else { child.encodeAll(facesContext); } } } }
protected void onComponentCreated(FaceletContext faceletContext, UIComponent menuCommand, UIComponent parent) { Application application = faceletContext.getFacesContext().getApplication(); UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent); UIComponent component = application.createComponent(getSubComponentType()); final String uid; if (fieldIdAttribute != null) { uid = fieldIdAttribute.getValue(faceletContext); } else { uid = root.createUniqueId(); } component.setId(uid); component.setRendererType(getSubRendererType()); setSubComponentAttributes(faceletContext, component); menuCommand.getFacets().put(getFacetName(), component); }
@Override public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException { final TobagoResponseWriter writer = getResponseWriter(facesContext); for (final UIComponent child : component.getChildren()) { if (child.isRendered()) { if (child instanceof AbstractUILink) { child.setRendererType(RendererTypes.LinkInsideLinks.name()); child.encodeAll(facesContext); } else { writer.startElement(HtmlElements.LI); writer.writeClassAttribute(BootstrapClass.NAV_ITEM); child.encodeAll(facesContext); writer.endElement(HtmlElements.LI); } } } }