public static void renderPassThroughAttributes(FacesContext context, UIComponent component) throws IOException { Map<String, Object> passthroughAttributes = component.getPassThroughAttributes(false); if (passthroughAttributes != null && !passthroughAttributes.isEmpty()) { ResponseWriter writer = context.getResponseWriter(); for (Map.Entry<String, Object> attribute : passthroughAttributes.entrySet()) { Object attributeValue = attribute.getValue(); if (attributeValue != null) { String value = null; if (attributeValue instanceof ValueExpression) { Object expressionValue = ((ValueExpression) attributeValue).getValue(context.getELContext()); if (expressionValue != null) { value = expressionValue.toString(); } } else { value = attributeValue.toString(); } if (value != null) { writer.writeAttribute(attribute.getKey(), value, null); } } } } } }
/** * <p class="changed_added_2_2">This is a convenience method that * simply calls {@link #getPassThroughAttributes(boolean)}, passing {@code true} * as the argument. This method must never return {@code null}.</p> * * @return the pass-through attribute map. * @since 2.2 */ public Map<String, Object> getPassThroughAttributes(){ return getPassThroughAttributes(true); }
/** * <p class="changed_added_2_2">This is a convenience method that * simply calls {@link #getPassThroughAttributes(boolean)}, passing {@code true} * as the argument. This method must never return {@code null}.</p> * * @since 2.2 */ public final Map<String, Object> getPassThroughAttributes(){ return getPassThroughAttributes(true); }
/** * @since 2.2 * @return */ public Map<String,Object> getPassThroughAttributes() { return getPassThroughAttributes(true); }
/** * <p class="changed_added_2_2">This is a convenience method that * simply calls {@link #getPassThroughAttributes(boolean)}, passing {@code true} * as the argument. This method must never return {@code null}.</p> * * @return the pass-through attribute map. * @since 2.2 */ public Map<String, Object> getPassThroughAttributes(){ return getPassThroughAttributes(true); }
/** * <p class="changed_added_2_2">This is a convenience method that * simply calls {@link #getPassThroughAttributes(boolean)}, passing {@code true} * as the argument. This method must never return {@code null}.</p> * * @return the pass-through attribute map. * @since 2.2 */ public Map<String, Object> getPassThroughAttributes(){ return getPassThroughAttributes(true); }
/** * <p class="changed_added_2_2"> * This is a convenience method that simply calls * {@link #getPassThroughAttributes(boolean)}, passing {@code true} as the argument. * This method must never return {@code null}. * </p> * * @return the pass-through attribute map. * @since 2.2 */ public Map<String, Object> getPassThroughAttributes() { return getPassThroughAttributes(true); }
public void applyMetadata(FaceletContext ctx, Object instance) { ((UIComponent) instance).getPassThroughAttributes().put(_name, _value); } }
private boolean isSennaOffAttrSet(UIComponent uiComponent) { boolean sennaOffAttrSet = false; if (uiComponent != null) { Map<String, Object> passThroughAttributes = uiComponent.getPassThroughAttributes(false); if ((passThroughAttributes != null) && !passThroughAttributes.isEmpty()) { sennaOffAttrSet = passThroughAttributes.containsKey("data-senna-off"); } } return sennaOffAttrSet; } }
public void applyMetadata(FaceletContext ctx, Object instance) { ((UIComponent) instance).getPassThroughAttributes().put( _name, _attr.getValueExpression(ctx, _type)); } }
@Override public Map<String, Object> getPassThroughAttributes(boolean create) { return getWrapped().getPassThroughAttributes(create); } }
public static void renderExternalPassThroughAttributes(ResponseWriter writer, UIComponent component) throws IOException { Map<String, Object> attributes = component.getPassThroughAttributes(); ELContext context = FacesContext.getCurrentInstance().getELContext(); if (!attributes.isEmpty()) { for (Map.Entry<String, Object> entry : attributes.entrySet()) { String name = entry.getKey(); Object value = entry.getValue(); Object result = value instanceof ValueExpression ? ((ValueExpression) value).getValue(context) : value; writer.writeAttribute(name, result.toString(), null); } } }
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException { ResponseWriter writer = facesContext.getResponseWriter(); String elementName = (String) component.getPassThroughAttributes().get( Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY); writer.endElement(elementName); }
@Override public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent) { if (parent.getParent() == null) { Map<String,Object> passThroughAttrs = c.getPassThroughAttributes(true); Object attrValue; attrValue = (this.elementName.isLiteral()) ? this.elementName.getValue(ctx) : this.elementName.getValueExpression(ctx, Object.class); passThroughAttrs.put(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY, attrValue); } }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { rendererParamsNotNull(context, component); if (!shouldEncode(component)) { return; } Map<String, Object> attrs = component.getPassThroughAttributes(); String localName = (String) attrs.get(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY); context.getResponseWriter().endElement(localName); }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { rendererParamsNotNull(context, component); if (!shouldEncode(component)) { return; } Map<String, Object> attrs = component.getPassThroughAttributes(); String localName = (String) attrs.get(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY); context.getResponseWriter().endElement(localName); }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { rendererParamsNotNull(context, component); if (!shouldEncode(component)) { return; } Map<String, Object> attrs = component.getPassThroughAttributes(); String localName = (String) attrs.get(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY); context.getResponseWriter().endElement(localName); }
@Override public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent) { if (parent.getParent() == null) { Map<String,Object> passThroughAttrs = c.getPassThroughAttributes(true); Object attrValue; attrValue = (this.elementName.isLiteral()) ? this.elementName.getValue(ctx) : this.elementName.getValueExpression(ctx, Object.class); passThroughAttrs.put(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY, attrValue); } }
@Override public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent) { if (parent.getParent() == null) { Map<String,Object> passThroughAttrs = c.getPassThroughAttributes(true); Object attrValue; attrValue = (this.elementName.isLiteral()) ? this.elementName.getValue(ctx) : this.elementName.getValueExpression(ctx, Object.class); passThroughAttrs.put(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY, attrValue); } }
@Override public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent) { if (parent.getParent() == null) { Map<String,Object> passThroughAttrs = c.getPassThroughAttributes(true); Object attrValue; attrValue = (this.elementName.isLiteral()) ? this.elementName.getValue(ctx) : this.elementName.getValueExpression(ctx, Object.class); passThroughAttrs.put(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY, attrValue); } }