adf 树选择侦听器不工作收到错误 <oracle.adf.view> <RichRenderer> <decodeUnknownKey> <ATTEMPT_SYNC_UNKNOWN_KEY>

adf tree selection listner not working getting error <oracle.adf.view> <RichRenderer> <decodeUnknownKey> <ATTEMPT_SYNC_UNKNOWN_KEY>

我以编程方式在 adf 中创建了一棵树。它显示正确并且我也能够遍历但是当我尝试单击任何节点时,我的 selectionListner() 函数不起作用而是它在控制台上给出以下错误:

 <oracle.adf.view> <RichRenderer> <decodeUnknownKey>   
<ATTEMPT_SYNC_UNKNOWN_KEY>**

以下是我的代码 1) 我创建了一个员工 class

 package view;
 import java.util.ArrayList;
 import java.util.List;

 public class Employee {
 private String name;
 private String location;
 private List<Employee> directs;

 public Employee(String name, String loc){
    this.name = name;
    this.location = loc;
    directs = new ArrayList<Employee>();
  }

public String getName() {
    return name;
}
  public String getLocation() {
    return location;
  }
  public List<Employee> getDirects() {
    return directs;
  }
  public void addDirect(Employee emp){
    directs.add(emp);
  }}

2) 我用构造函数创建了一个托管 bean:

List<Employee> allEmployees = new ArrayList<Employee>();
TreeModel employeeTree;

public TestPage_1() {
    super();
    Employee manager1 = new Employee("John","London");
        Employee emp = new Employee("Jack", "London");
        manager1.addDirect(emp);
        emp = new Employee("Ken","New York");
        manager1.addDirect(emp);
        Employee manager2 = new Employee("Ravi","Bangalore");
        emp = new Employee("Ramesh","Bangalore");
        manager2.addDirect(emp);
        Employee manager3 = new Employee("Raju","Pune");
        emp = new Employee("Rakesh","Pune");
        manager3.addDirect(emp);
        manager2.addDirect(manager3);
        emp = new Employee("Jamie","California");

        allEmployees.add(manager1);
        allEmployees.add(manager2);
        allEmployees.add(emp);     

        //Wrapping the list in to a class used by ADF TreeTable.

}

public TreeModel getModel() {
      employeeTree =
          new ChildPropertyTreeModel(allEmployees,"directs");
    return employeeTree;
  }

和一个选择监听器:

public void nodeclicked(SelectionEvent selectionEvent) 
    String adfSelectionListener = "#{backingBeanScope.backing_testPage_1.model.makeCurrent}";

           FacesContext fctx = FacesContext.getCurrentInstance();
           Application application = fctx.getApplication();
           ELContext elCtx = fctx.getELContext();
           ExpressionFactory exprFactory = application.getExpressionFactory();
           MethodExpression me = null;
           me =
    exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class, new Class[] { SelectionEvent.class });
           me.invoke(elCtx, new Object[] { selectionEvent });

           RichTree tree = (RichTree)selectionEvent.getSource();
           TreeModel model = (TreeModel)tree.getValue();
           //get selected nodes
           RowKeySet rowKeySet = selectionEvent.getAddedSet();
           Iterator rksIterator = rowKeySet.iterator();
           while (rksIterator.hasNext()) {
               List key = (List)rksIterator.next();
               JUCtrlHierBinding treeBinding = null;
               treeBinding = (JUCtrlHierBinding)((CollectionModel)tree.getValue()).getWrappedData();
               JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
               Row rw = nodeBinding.getRow();
               System.out.println("row: " + rw.getAttribute(0)); // You can get any attribute
               System.out.println("View Object name---->" + nodeBinding.getViewObject().getName());

           }
    }

我的树 UI 是:

<af:tree id="testPage_tree" var="node" value="#{backingBeanScope.backing_testPage_1.model}"
                         binding="#{backingBeanScope.backing_testPage_1.testPage_tree}"
                         selectionListener="#{backingBeanScope.backing_testPage_1.nodeclicked}">
                    <f:facet name="nodeStamp">
                        <af:outputLabel value="#{node.name}" id="ol1"
                                        binding="#{backingBeanScope.backing_testPage_1.ol1}"/>
                    </f:facet>
                </af:tree>

我试图找出树中的哪个节点被选中,但我的断点在选择侦听器函数中不起作用。

您错过了设置 rowSelection 属性 树组件