Package org.richfaces.component.attribute

Examples of org.richfaces.component.attribute.AutocompleteProps


    public static DataModel<Object> getItems(FacesContext facesContext, UIComponent component, String value) {
        if (!(component instanceof AutocompleteProps)) {
            return null;
        }
        AutocompleteProps autocomplete = (AutocompleteProps) component;
        Object itemsObject = null;

        MethodExpression autocompleteMethod = autocomplete.getAutocompleteMethod();
        if (autocompleteMethod != null) {
            try {
                try {
                    itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new Object[] { facesContext,
                            component, value });
                } catch (MethodNotFoundException e1) {
                    try {
                        // fall back to evaluating an expression assuming there is just one parameter (RF-11469)
                        itemsObject = autocomplete.getAutocompleteMethodWithOneParameter().invoke(facesContext.getELContext(), new Object[] { value });
                    } catch (MethodNotFoundException e2) {
                        ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
                        autocompleteMethod = expressionFactory.createMethodExpression(facesContext.getELContext(),
                                autocompleteMethod.getExpressionString(), Object.class, new Class[] { String.class });
                        itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new Object[] { value });
                    }
                }
            } catch (ELException ee) {
                LOGGER.error(ee.getMessage(), ee);
            }
        } else {
            itemsObject = autocomplete.getAutocompleteList();
        }

        DataModel result;

        if (itemsObject instanceof Object[]) {
View Full Code Here

TOP

Related Classes of org.richfaces.component.attribute.AutocompleteProps

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.