Package javax.faces.convert

Examples of javax.faces.convert.Converter


            else
            {
                String s = _converter.getExpressionString();
                if (s != null)
                {           
                    Converter converter = getFacesContext().getApplication().createConverter(s);
                    comp.setConverter(converter);
                }
            }
        }
    }
View Full Code Here


            }
            else {
                value = getValue(component);
            }

            Converter converter = ((ValueHolder)component).getConverter();
            if (converter == null  && value != null)
            {

                try
                {
                    converter = facesContext.getApplication().createConverter(value.getClass());
                    if (log.isDebugEnabled()) log.debug("the created converter is " + converter);
                }
                catch (FacesException e)
                {
                    log.error("No converter for class " + value.getClass().getName() + " found (component id=" + component.getId() + ").");
                    // converter stays null
                }
            }

            if (converter == null)
            {
                if (value == null)
                {
                    if (log.isDebugEnabled()) log.debug("returning an empty string");
                    return "";
                }

                if (log.isDebugEnabled()) log.debug("returning an .toString");
                return value.toString();
               
            }

            if (log.isDebugEnabled()) log.debug("returning converter get as string " + converter);
            return converter.getAsString(facesContext, component, value);
           
        }
        catch(PropertyNotFoundException ex)
        {
            log.error("Property not found - called by component : "+getPathToComponent(component),ex);
View Full Code Here

     * @throws FacesException if the Converter could not be created
     */
    public static Converter findUISelectManyConverter(FacesContext facesContext,
                                                      UISelectMany component)
    {
        Converter converter = component.getConverter();
        if (converter != null) return converter;

        //Try to find out by value binding
        ValueExpression vb = component.getValueExpression("value");
        if (vb == null) return null;
View Full Code Here

        {
            //Replace "" by null value
            submittedValue = null;
        }

        Converter converter;
        try
        {
            converter = findUIOutputConverter(facesContext, output);
        }
        catch (FacesException e)
        {
            throw new ConverterException(e);
        }

        return converter == null ? submittedValue : converter
                .getAsObject(facesContext, output, (String) submittedValue);
    }
View Full Code Here

            }
            throw new IllegalArgumentException("Submitted value of type String for component : "
                    + getPathToComponent(output) + "expected");
        }

        Converter converter;
        try
        {
            converter = findUIOutputConverter(facesContext, output);
        }
        catch (FacesException e)
        {
            throw new ConverterException(e);
        }

        return converter == null ? submittedValue : converter
                .getAsObject(facesContext, output, (String) submittedValue);
    }
View Full Code Here

            else
            {
                String s = _converter.getExpressionString();
                if (s != null)
                {           
                    Converter converter = getFacesContext().getApplication().createConverter(s);
                    comp.setConverter(converter);
                }
            }
        }
    }
View Full Code Here

            else
            {
                String s = _converter.getExpressionString();
                if (s != null)
                {           
                    Converter converter = getFacesContext().getApplication().createConverter(s);
                    comp.setConverter(converter);
                }
            }
        }
    }
View Full Code Here

            UISelectMany selectMany) throws IOException
    {
        final String layout = getLayout(selectMany);
        if (layout != null)
        {
            Converter converter = getConverter(facesContext, selectMany);
            if (layout.equals(PAGE_DIRECTION))
            {
                renderCheckboxListVertically(facesContext, selectMany,
                        converter);
            }
View Full Code Here

        {
            throw new IllegalStateException("UISelectMany expected");
        }

        UISelectMany uiSelectMany = (UISelectMany)uiComponent;
        Converter converter = getConverter(facesContext, uiSelectMany);
        List selectItemList = RendererUtils.getSelectItemList(uiSelectMany);
        if (index >= selectItemList.size())
        {
            throw new IndexOutOfBoundsException("index " + index + " >= " + selectItemList.size());
        }
View Full Code Here

    }

    protected Converter getConverter(FacesContext facesContext,
            UISelectMany selectMany)
    {
        Converter converter;
        try
        {
            converter = RendererUtils.findUISelectManyConverter(facesContext,
                    selectMany);
        }
View Full Code Here

TOP

Related Classes of javax.faces.convert.Converter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.