AutoComplete could have an CompleteListener

UI Components for JSF
Post Reply
meszias
Posts: 1
Joined: 18 Apr 2011, 21:43

18 Apr 2011, 22:07

The auto complete has the "completeMethod" attribute. And the method signature is

Code: Select all

List completeMethod(String completestring){}
List completeMethod(String completestring), only an string object from the inputbox of the Autocomplete's component. I want an listener because i want to know witch AutoComplete component came the text, like this:

Code: Select all

List completeMethod(UIComponent component, String completestring){}
I know this is not the best approch, maybe an CompleteEvent with the text inside would be better. I found the places to make the changes, but im not sure if i can do those modifications, or the best way is suggest those modifications first:

Code: Select all

// Both at package org.primefaces.component.autocomplete;
// AutoCompleteHandler.java
public class AutoCompleteHandler extends ComponentHandler {
    @SuppressWarnings("unchecked")
    protected MetaRuleset createMetaRuleset(Class type) { 
         metaRuleset.addRule(new MethodRule("completeMethod", List.class, new Class[]{UIComponent.class, String.class}));
    }
}
// AutoCompleteRenderer.java
public class AutoCompleteRenderer extends InputRenderer {
 @Override
    public void encodeResults(FacesContext facesContext, UIComponent component) throws IOException {
         List results = (List) me.invoke(facesContext.getELContext(), new Object[]{component, query});
    }
}
Is possible to create this Event on AutoComplete to Primefaces ?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests