----------------------------------------------------------------------------
public List onSuggest(String string) {
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
//set the bind variable value that is used to filter the View Object
//query of the suggest list. The View Object instance has a View
//Criteria assigned
OperationBinding setVariable = (OperationBinding) bindings.get("setSearchCriteria");
setVariable.getParamsMap().put("value", string);
setVariable.execute();
//the data in the suggest list is queried by a tree binding.
JUCtrlHierBinding hierBinding = (JUCtrlHierBinding) bindings.get("CountriesLookup1");
//re-query the list based on the new bind variable values
hierBinding.executeQuery();
//The rangeSet, the list of queries entries, is of type
//JUCtrlValueBndingRef.
List displayDataList = hierBinding.getRangeSet();
ArrayList selectItems = new ArrayList();
for (JUCtrlValueBindingRef displayData : displayDataList){
Row rw = displayData.getRow();
selectItems.add(new SelectItem((String)rw.getAttribute("LocName"),(String)rw.getAttribute("LocName")));
}
return selectItems;
}
ArrayList
for (JUCtrlValueBindingRef displayData : displayDataList){
Row rw = displayData.getRow();
selectItems.add(new SelectItem((String)rw.getAttribute("LocName"),(String)rw.getAttribute("LocName")));
}
return selectItems;
}
------------------------------------------------------------------------
------------------------------------------------------------------------
---------------------------------------------------------------------------
Create a Read Only VO CountriesLookup.
Query : SELECT distinct(loc_name) FROM country.
Bind Variable :
Kind="viewcriteria"
Type="java.lang.String"/>
View Criteria :
ViewObjectName="neelmani.model.queries.CountriesLookup"
Conjunction="AND">
Value="InAdvancedMode"/>
Value="false"/>
Value="true"/>
Value="true"/>
Value="Basic"/>
UpperColumns="1">
ViewAttribute="LocName"
Operator="STARTSWITH"
Conjunction="AND"
Value=":SearchCriteria"
IsBindVarValue="true"
Required="Optional"/>
---------------------------------------------------------
Put the bellow code in CountriesLookupImpl.(countriedLookup View Object)
/**
* Returns the variable value for SearchCriteria.
* @return variable value for SearchCriteria
*/
public String getSearchCriteria() {
return (String)ensureVariableManager().getVariableValue("SearchCriteria");
}
/**
* Sets
value
for variable SearchCriteria.* @param value value to bind as SearchCriteria
*/
public void setSearchCriteria(String value) {
ensureVariableManager().setVariableValue("SearchCriteria", value);
}
--
Select and sattle right the setSearchCriteria from Client Interface of View Object.