/** * Adds the following accessibility attributes to an HTML DOM element. * <pre> * "aria-required" if the component is required * "aria-invalid" if the component is invalid * "aria-labelledby" if the component has a labelledby attribute * "disabled" and "aria-disabled" if the component is disabled * "readonly" and "aria-readonly" if the component is readonly * </pre> * @param context the {@link FacesContext} * @param component the {@link UIInput} component to add attributes for * @throws IOException if any error occurs writing the response */ protected void renderAccessibilityAttributes(FacesContext context, UIInput component) throws IOException { renderAccessibilityAttributes(context, component, isDisabled(component), isReadOnly(component)); }
protected boolean shouldDecode(UIInput component) { return !isDisabled(component) && !isReadOnly(component); }
protected void renderAccessibilityAttributes(FacesContext context, UIInput component, boolean disabled, boolean readonly) throws IOException { ResponseWriter writer = context.getResponseWriter(); renderARIARequired(context, component); renderARIAInvalid(context, component); String labelledBy = (String) component.getAttributes().get("labelledby"); if (labelledBy != null) { writer.writeAttribute(HTML.ARIA_LABELLEDBY, labelledBy, null); } if (disabled) { writer.writeAttribute("disabled", "disabled", null); writer.writeAttribute(HTML.ARIA_DISABLED, "true", null); } if (readonly) { writer.writeAttribute("readonly", "readonly", null); writer.writeAttribute(HTML.ARIA_READONLY, "true", null); } }
protected String getOptionAsString(FacesContext context, UIComponent component, Converter converter, Object value) throws ConverterException { if (!(component instanceof ValueHolder)) { return value == null ? null : value.toString(); } if (converter == null) { if (value == null) { return ""; } else if (value instanceof String) { return (String) value; } else { Converter implicitConverter = findImplicitConverter(context, component); return implicitConverter == null ? value.toString() : implicitConverter.getAsString(context, component, value); } } else { return converter.getAsString(context, component, value); } }
selectItems.add(createSelectItem(context, uiSelectItems, item, null)); Object key = it.next(); selectItems.add(createSelectItem(context, uiSelectItems, map.get(key), String.valueOf(key))); selectItems.add(createSelectItem(context, uiSelectItems, item, null)); selectItems.add(createSelectItem(context, uiSelectItems, item, null));