@Override public void decode(FacesContext context, UIComponent component) { super.decodeBehaviors(context, component); }
protected String buildAjaxRequest(FacesContext context, AjaxSource source) { return buildAjaxRequest(context, source, null); }
protected boolean shouldDecode(UIInput component) { return !isDisabled(component) && !isReadOnly(component); }
/** * 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 void renderDomEvents(FacesContext context, UIComponent component, String[] eventAttrs) throws IOException { if (component instanceof ClientBehaviorHolder) { renderDomEvents(context, component, eventAttrs, ((ClientBehaviorHolder) component).getClientBehaviors()); } else { renderPassThruAttributes(context, component, eventAttrs); } }
/** * Restores checked, disabled select items (#3296) and checks if at least one disabled select item has been submitted - * this may occur with client side manipulation (#3264) * @return <code>newSubmittedValues</code> merged with checked, disabled <code>oldValues</code> * @throws javax.faces.FacesException if client side manipulation has been detected, in order to reject the submission */ protected String[] validateSubmittedValues(FacesContext context, UIInput component, Object[] oldValues, String... submittedValues) throws FacesException { List<String> validSubmittedValues = doValidateSubmittedValues( context, component, oldValues, getSelectItems(context, component), submittedValues); return validSubmittedValues.toArray(new String[validSubmittedValues.size()]); }
@Override public void decode(FacesContext context, UIComponent component) { super.decode(context, component); decodeBehaviors(context, component); }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); encodeResources(context); if (!context.getPartialViewContext().isAjaxRequest()) { encodeOnloadScripts(writer); } writer.endElement("body"); }
protected void renderOnchange(FacesContext context, UIComponent component) throws IOException { this.renderDomEvent(context, component, "onchange", "change", "valueChange", null); }
protected int countSelectItems(SelectItem[] selectItems) { if (selectItems == null) { return 0; } int count = selectItems.length; for (SelectItem selectItem : selectItems) { if (selectItem instanceof SelectItemGroup) { count += countSelectItems(((SelectItemGroup) selectItem).getSelectItems()); } } return count; }
public static void encodeCheckbox(FacesContext context, boolean checked) throws IOException { encodeCheckbox(context, checked, false, false, null); }
protected boolean containsEL(List<String> values) { if (!values.isEmpty()) { // Both MyFaces and Mojarra use ArrayLists. Therefore, index loop can be used. for (int i = 0; i < values.size(); i++) { if (isExpression(values.get(i))) { return true; } } } return false; }
protected void renderDomEvent(FacesContext context, UIComponent component, String domEvent, String behaviorEvent, String behaviorEventAlias, String command) throws IOException { ResponseWriter writer = context.getResponseWriter(); String callback = buildDomEvent(context, component, domEvent, behaviorEvent, behaviorEventAlias, command); if (callback != null) { writer.writeAttribute(domEvent, callback, domEvent); } }
protected void renderChildren(FacesContext context, UIComponent component) throws IOException { if (component.getChildCount() > 0) { for (int i = 0; i < component.getChildCount(); i++) { UIComponent child = component.getChildren().get(i); renderChild(context, child); } } }
protected void renderChild(FacesContext context, UIComponent child) throws IOException { if (!child.isRendered()) { return; } child.encodeBegin(context); if (child.getRendersChildren()) { child.encodeChildren(context); } else { renderChildren(context, child); } child.encodeEnd(context); }
/** * Used by script-only widget to fix #3265 and allow updating of the component. * * @param context the {@link FacesContext}. * @param component the widget without actual HTML markup. * @param clientId the component clientId. * @throws IOException */ protected void renderDummyMarkup(FacesContext context, UIComponent component, String clientId) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("div", null); writer.writeAttribute("id", clientId, null); writer.writeAttribute("style", "display: none;", null); renderPassThruAttributes(context, component, null); writer.endElement("div"); }
@Override public void decode(FacesContext context, UIComponent component) { super.decodeBehaviors(context, component); }
protected void renderOnclick(FacesContext context, UIComponent component, String command) throws IOException { this.renderDomEvent(context, component, "onclick", "click", "action", command); }
protected int countSelectItems(List<SelectItem> selectItems) { if (selectItems == null) { return 0; } int count = selectItems.size(); for (int i = 0; i < selectItems.size(); i++) { SelectItem selectItem = selectItems.get(i); if (selectItem instanceof SelectItemGroup) { count += countSelectItems(((SelectItemGroup) selectItem).getSelectItems()); } } return count; }
@Override public void decode(FacesContext context, UIComponent component) { super.decodeBehaviors(context, component); }