public static boolean renderBehaviorizedAttribute()

in myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/util/Html5RendererUtils.java [438:463]


    public static boolean renderBehaviorizedAttribute(
            FacesContext facesContext, ResponseWriter writer,
            String componentProperty, UIComponent component,
            String eventName, Collection<ClientBehaviorContext.Parameter> eventParameters, Map<String, List<ClientBehavior>> clientBehaviors,
            String htmlAttrName, String attributeValue) throws IOException {
        List<ClientBehavior> cbl = (clientBehaviors != null) ? clientBehaviors.get(eventName) : null;

        if (cbl == null || cbl.size() == 0) {
            return renderHTMLAttribute(writer, componentProperty, htmlAttrName, attributeValue);
        }

        if (cbl.size() > 1 || (cbl.size() == 1 && attributeValue != null)) {
            return renderHTMLAttribute(writer, componentProperty, htmlAttrName,
                    buildBehaviorChain(facesContext,
                            component, eventName, eventParameters, clientBehaviors,
                            attributeValue, StringUtils.EMPTY));
        } else {
            //Only 1 behavior and attrValue == null, so just render it directly
            return renderHTMLAttribute(writer, componentProperty, htmlAttrName,
                    cbl.get(0).getScript(
                            ClientBehaviorContext
                                    .createClientBehaviorContext(facesContext, component,
                                            eventName, component.getClientId(facesContext),
                                            eventParameters)));
        }
    }