@Override public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { Converter converter = ComponentUtils.getConverter(context, component); if (converter != null) { String convertableValue = submittedValue == null ? null : submittedValue.toString(); return converter.getAsObject(context, component, convertableValue); } else { return submittedValue; } }
private Object convertValue(FacesContext context, String submittedItemValue) { Converter converter = ComponentUtils.getConverter(context, this); if (converter == null) { return submittedItemValue; } else { return converter.getAsObject(context, this, submittedItemValue); } }
@Override public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { TextEditor editor = (TextEditor) component; String value = (String) submittedValue; Converter converter = ComponentUtils.getConverter(context, component); if (converter != null) { return converter.getAsObject(context, editor, value); } return value; } }
private Object convertValue(FacesContext context, String submittedItemValue) { Converter converter = ComponentUtils.getConverter(context, this); if (converter == null) { return submittedItemValue; } else { return converter.getAsObject(context, this, submittedItemValue); } } }
@Override public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { Editor editor = (Editor) component; String value = (String) submittedValue; Converter converter = ComponentUtils.getConverter(context, component); if (converter != null) { return converter.getAsObject(context, editor, value); } return value; } }
@Override public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { String submittedValueString = (String) submittedValue; if (LangUtils.isValueBlank(submittedValueString)) { return null; } Converter converter = ComponentUtils.getConverter(context, component); if (converter != null) { return converter.getAsObject(context, component, submittedValueString); } return submittedValue; }
@Override public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { Chips chips = (Chips) component; if (submittedValue == null || submittedValue.equals("")) { return null; } Converter converter = ComponentUtils.getConverter(context, component); String[] values = (String[]) submittedValue; List list = new ArrayList(); for (String value : values) { if (isValueBlank(value)) { continue; } Object convertedValue = converter != null ? converter.getAsObject(context, chips, value) : value; if (convertedValue != null) { list.add(convertedValue); } } return list; } }
protected void encodeSuggestions(FacesContext context, AutoComplete ac, List items) throws IOException { boolean customContent = !ac.getColums().isEmpty(); Converter converter = ComponentUtils.getConverter(context, ac); if (customContent) { encodeSuggestionsAsTable(context, ac, items, converter); } else { encodeSuggestionsAsList(context, ac, items, converter); } }
@Override public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { AutoComplete ac = (AutoComplete) component; if (submittedValue == null || submittedValue.equals("") || ac.isMoreTextRequest(context)) { return null; } Converter converter = ComponentUtils.getConverter(context, component); if (ac.isMultiple()) { String[] values = (String[]) submittedValue; List list = new ArrayList(); for (String value : values) { if (isValueBlank(value)) { continue; } Object convertedValue = converter != null ? converter.getAsObject(context, ac, value) : value; if (convertedValue != null) { list.add(convertedValue); } } return list; } else { if (converter != null) { return converter.getAsObject(context, component, (String) submittedValue); } else { return submittedValue; } } }
converter = ComponentUtils.getConverter(context, comp);
protected void encodeListItems(FacesContext context, MultiSelectListbox listbox, SelectItem[] selectItems) throws IOException { if (selectItems != null && selectItems.length > 0) { ResponseWriter writer = context.getResponseWriter(); Converter converter = ComponentUtils.getConverter(context, listbox); String itemValue = null; for (int i = 0; i < selectItems.length; i++) { SelectItem selectItem = selectItems[i]; itemValue = converter != null ? converter.getAsString(context, listbox, selectItem.getValue()) : String.valueOf(selectItem.getValue()); writer.startElement("li", null); writer.writeAttribute("class", MultiSelectListbox.ITEM_CLASS, null); writer.writeAttribute("data-value", itemValue, null); writer.startElement("span", listbox); writer.writeText(selectItem.getLabel(), null); writer.endElement("span"); if (selectItem instanceof SelectItemGroup) { SelectItemGroup group = (SelectItemGroup) selectItem; SelectItem[] groupItems = group.getSelectItems(); if (groupItems != null && groupItems.length > 0) { encodeGroupItems(context, listbox, group.getSelectItems()); } } writer.endElement("li"); } } }
Converter converter = ComponentUtils.getConverter(context, chips);
Converter converter = ComponentUtils.getConverter(context, ac); String var = ac.getVar(); boolean pojo = var != null;
@Override public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { Converter converter = ComponentUtils.getConverter(context, component); if (converter != null) { String convertableValue = submittedValue == null ? null : submittedValue.toString(); return converter.getAsObject(context, component, convertableValue); } else { return submittedValue; } }
@Override public Object getConvertedValue(final FacesContext context, final UIComponent component, final Object submittedValue) { final CKEditor ckEditor = (CKEditor) component; final String value = (String) submittedValue; final Converter converter = ComponentUtils.getConverter(context, component); if (converter != null) { return converter.getAsObject(context, ckEditor, value); } return value; } }
@Override public Object getConvertedValue(final FacesContext context, final UIComponent component, final Object submittedValue) { final CodeMirror codeMirror = (CodeMirror) component; final String value = (String) submittedValue; final Converter converter = ComponentUtils.getConverter(context, component); if (converter != null) { return converter.getAsObject(context, codeMirror, value); } return value; }
@Override public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { Editor editor = (Editor) component; String value = (String) submittedValue; Converter converter = ComponentUtils.getConverter(context, component); if (converter != null) { return converter.getAsObject(context, editor, value); } return value; } }
private Object convertValue(FacesContext context, String submittedItemValue) { Converter converter = ComponentUtils.getConverter(context, this); if(converter == null) return submittedItemValue; else return converter.getAsObject(context, this, submittedItemValue); }
@Override public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException { TextEditor editor = (TextEditor) component; String value = (String) submittedValue; Converter converter = ComponentUtils.getConverter(context, component); if (converter != null) { return converter.getAsObject(context, editor, value); } return value; } }
protected void encodeSuggestions(FacesContext context, AutoComplete ac, List items) throws IOException { boolean customContent = ac.getColums().size() > 0; Converter converter = ComponentUtils.getConverter(context, ac); if (customContent) { encodeSuggestionsAsTable(context, ac, items, converter); } else { encodeSuggestionsAsList(context, ac, items, converter); } }