Friday, December 17, 2010

How-to Discuss It The ViewCriteria A User Chose In An Af:query Component

The af:query part defines a hunting form for focus users to come in searchconditions for a choosen View Criteria. A View Criteria is a declared whereclauses that you can emanate declaratively on the ADF Business Component ViewObject.

A default View Criteria that allows users to hunting in allattributes exists by default and unprotected in the Data Controls panel.

To obstruct the user question for modification, or only to knowabout the choosen View Criteria, you overrule the QueryListener skill on the af:query part of the af:table component. Overridingthe QueryListener on the list makessense if the list allows users to serve filter the outcome set using columnfilters.

The ethics next isfrom a managed bean with law question listener handlers tangible is to af:query componentand the af:table component. The default listener access copied to the clipboard was "#{bindings.ImplicitViewCriteriaQuery.processQuery}"

open canceled onQueryList(QueryEventqueryEvent) {
// The generated QueryListener replacedby this method
//#{bindings.ImplicitViewCriteriaQuery.processQuery}
QueryDescriptor qdes =queryEvent.getDescriptor();

//print or record choosen View Criteria
System.out.println("NAME"+qdes.getName());


//call default Query Event
invokeQueryEventMethodExpression("
#{bindings.ImplicitViewCriteriaQuery.processQuery}",queryEvent);

}

publicvoid onQueryTable(QueryEvent queryEvent) {
// The generated QueryListener replacedby this method
//#{bindings.ImplicitViewCriteriaQuery.processQuery}
QueryDescriptor qdes =queryEvent.getDescriptor();

//print or record choosen View Criteria
System.out.println("NAME"+qdes.getName());

invokeQueryEventMethodExpression(
"#{bindings.ImplicitViewCriteriaQuery.processQuery}",queryEvent);
}

privatevoid invokeQueryEventMethodExpression(
String expression,QueryEvent queryEvent){
FacesContext fctx = FacesContext.getCurrentInstance();
ELContext elctx = fctx.getELContext();
ExpressionFactory efactory
fctx.getApplication().getExpressionFactory();

MethodExpression me =
efactory.createMethodExpression(elctx,expression,
Object.class,
newClass[]{QueryEvent.class});
me.invoke(elctx, newObject[]{queryEvent});
}

Of course, this ethics moreover may be used as a starting pointfor other question manipulations and moreover functions with saved law criterias.

To about the af:query component, see:

No comments:

Post a Comment