删除<af:inputlistofvalue>

时间:2019-01-24 15:55:08

标签: oracle-adf jdeveloper

我正在寻找一种方法来修剪af:inputListOfValues组件中的前导和尾随空格。我可以以编程方式访问“查看条件”,并从VOImpl自定义类中修剪所有值,但是我不确定如何将其公开给实际组件。是否可以将我的自定义方法暴露给LOV组件?预先谢谢你!

1 个答案:

答案 0 :(得分:0)

为了修整我的LOV组件中的值,我不得不重写exe​​cuteQueryForCollection。这样,我就可以访问我的参数并进行修剪。

@Override
protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams) {
    ArrayList<Object[]> alParams = new ArrayList<Object[]>();

    //Pass along any explicit (user entered) parameters for the query. Also some implicit parameters.
    if(params != null && params.length > 0){
        for (Object o : params) {
            alParams.add((Object[])o);
        }
        //Access the value of each object and trim it
        for (Object[] p: alParams){
            if(p.length > 1){
                p[1] = trimCriteria(p[1]);  
            }  
        }
        Object[] trimParams = alParams.toArray();
        super.executeQueryForCollection(qc, trimParams, noUserParams);
    } else {
        super.executeQueryForCollection(qc, params, noUserParams);
    }

}


public Object trimCriteria (Object searchCriteria){
    if(searchCriteria instanceof String)
    if(searchCriteria != null){
        searchCriteria = ((String)searchCriteria).trim();
    }
    return searchCriteria;
}`