@Override public void decode(FacesContext context, UIComponent component) { ColorPicker colorPicker = (ColorPicker) component; if (!shouldDecode(colorPicker)) { return; } String paramName = colorPicker.getClientId(context) + "_input"; Map<String, String> params = context.getExternalContext().getRequestParameterMap(); if (params.containsKey(paramName)) { String submittedValue = params.get(paramName); if (!COLOR_HEX_PATTERN.matcher(submittedValue).matches()) { return; } Converter converter = colorPicker.getConverter(); if (converter != null) { colorPicker.setSubmittedValue( converter.getAsObject(context, component, submittedValue)); } else { colorPicker.setSubmittedValue(submittedValue); } } }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { ColorPicker colorPicker = (ColorPicker) component; Converter converter = colorPicker.getConverter(); String value; if (converter != null) { value = converter.getAsString(context, component, colorPicker.getValue()); } else { value = (String) colorPicker.getValue(); } encodeMarkup(context, colorPicker, value); encodeScript(context, colorPicker, value); }
@Override public void decode(FacesContext context, UIComponent component) { ColorPicker colorPicker = (ColorPicker) component; String paramName = colorPicker.getClientId(context) + "_input"; Map<String, String> params = context.getExternalContext().getRequestParameterMap(); if (params.containsKey(paramName)) { String submittedValue = params.get(paramName); if (!COLOR_HEX_PATTERN.matcher(submittedValue).matches()) { return; } Converter converter = colorPicker.getConverter(); if (converter != null) { colorPicker.setSubmittedValue( converter.getAsObject(context, component, submittedValue)); } else { colorPicker.setSubmittedValue(submittedValue); } } }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { ColorPicker colorPicker = (ColorPicker) component; Converter converter = colorPicker.getConverter(); String value; if (converter != null) { value = converter.getAsString(context, component, colorPicker.getValue()); } else { value = (String) colorPicker.getValue(); } encodeMarkup(context, colorPicker, value); encodeScript(context, colorPicker, value); }