13 Replies Latest reply: Jan 18, 2013 10:50 AM by User268653 RSS

    TreeTable selfjoin

    User268653
      hi every body


      i have created a treetable based on self join viewobject,how i can get the data of current row (child row) ,because i am always get the data of parent row.


      Thanks in advance.
        • 1. Re: TreeTable selfjoin
          Frank Nimphius-Oracle
          Hi,

          see if this helps: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/32-tree-table-from-single-vo-169174.pdf

          Frank
          • 2. Re: TreeTable selfjoin
            User268653
            hi
            i saw the example and test it , and i have the same problem, i notice that i am always get the row data of parent node (previous node) not the current node.
            any help please.


            thanks

            Edited by: 842127 on Jan 14, 2013 6:11 AM

            Edited by: 842127 on Jan 14, 2013 9:05 AM
            • 3. Re: TreeTable selfjoin
              User268653
              any help please.
              • 4. Re: TreeTable selfjoin
                User268653
                hi every body , i use following code for my question.
                    public void rowSelected(SelectionEvent selectionEvent) {
                        
                        ADFUtil.invokeEL("#{bindings.Parent.treeModel.makeCurrent}",
                                         new Class[] { SelectionEvent.class },
                                         new Object[] { selectionEvent });
                      
                        
                        RichTreeTable treeTable = this.getParenttable();
                        RowKeySet rks = treeTable.getSelectedRowKeys();
                        
                        Iterator rksIterator = rks.iterator();
                        
                        if (rksIterator.hasNext()) {
                            List key = (List)rksIterator.next();
                            JUCtrlHierBinding treeBinding = null;
                            CollectionModel collectionmodel = (CollectionModel)treeTable.getValue();
                            treeBinding = (JUCtrlHierBinding)collectionmodel.getWrappedData();
                            JUCtrlHierNodeBinding node = treeBinding.findNodeByKeyPath(key);
                            Row rw = node.getRow();
                            System.out.println("Selected: "+rw.getAttribute(0)+" "+rw.getAttribute(1));  */// always print the value of parent node for current row*
                           
                        }
                        
                        
                    }
                Edited by: 842127 on Jan 15, 2013 6:04 AM

                Edited by: 842127 on Jan 15, 2013 8:45 PM

                Edited by: 842127 on Jan 16, 2013 8:00 PM
                • 5. Re: TreeTable selfjoin
                  Puthanampatti
                  try this...

                  selectedRowKeys="#{pageFlowScope.YourBean.selectedRowKey}"

                  private RowKeySet selectedRowKey;

                  public void setSelectedRowKey(RowKeySet selectedRowKey) {
                  this.selectedRowKey = selectedRowKey;
                  }

                  public RowKeySet getSelectedRowKey() {
                  return selectedRowKey;
                  }

                  public void rowSelected(SelectionEvent selectionEvent)
                  {
                  selectedRowKey = selectionEvent.getAddedSet();

                  if(selectedRowKey.size()>0)
                  {
                  ArrayList rowKeySetItemData;
                  rowKeySetItemData = (ArrayList)selectedRowKey.iterator().next();

                  }

                  }
                  • 6. Re: TreeTable selfjoin
                    User268653
                    hi
                    i get this error at this line : rowKeySetItemData = (ArrayList)selectedRowKey.iterator().next();
                    Caused by: java.lang.ClassCastException: java.util.Collections$SingletonList cannot be cast to java.util.ArrayList
                         at ManagedBeanPkg.ManagedBean.rowSelected(ManagedBean.java:91)
                         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                         at java.lang.reflect.Method.invoke(Method.java:597)
                         ... 59 more
                    Edited by: 842127 on Jan 16, 2013 2:37 AM
                    • 7. Re: TreeTable selfjoin
                      User268653
                      any help please.
                      • 8. Re: TreeTable selfjoin
                        Puthanampatti
                        check..

                        http://amulyamishras-tech-blog.blogspot.com/2011_06_01_archive.html
                        • 9. Re: TreeTable selfjoin
                          User268653
                          hi Puthanampatti
                          the solution you suggested i made it in the following as i mentioned before :
                          public void rowSelected(SelectionEvent selectionEvent) {
                                  
                                  ADFUtil.invokeEL("#{bindings.Parent.treeModel.makeCurrent}",
                                                   new Class[] { SelectionEvent.class },
                                                   new Object[] { selectionEvent });
                                
                                  
                                  RichTreeTable treeTable = this.getParenttable();
                                  RowKeySet rks = treeTable.getSelectedRowKeys();
                                  
                                  Iterator rksIterator = rks.iterator();
                                  
                                  if (rksIterator.hasNext()) {
                                      List key = (List)rksIterator.next();
                                      JUCtrlHierBinding treeBinding = null;
                                      CollectionModel collectionmodel = (CollectionModel)treeTable.getValue();
                                      treeBinding = (JUCtrlHierBinding)collectionmodel.getWrappedData();
                                      JUCtrlHierNodeBinding node = treeBinding.findNodeByKeyPath(key);
                                      Row rw = node.getRow();
                                      System.out.println("Selected: "+rw.getAttribute(0)+" "+rw.getAttribute(1));  */// always print the value of parent node for current row*
                                     
                                  }
                                  
                                  
                              }
                          the problem whit this code that i can not get the data of current record .
                          System.out.println("Selected: "+rw.getAttribute(0)+" "+rw.getAttribute(1));  /// always print the value of parent node for current row**

                          so, i try your solution :
                          selectedRowKeys="#{pageFlowScope.YourBean.selectedRowKey}"
                          
                          private RowKeySet selectedRowKey;
                          
                          public void setSelectedRowKey(RowKeySet selectedRowKey) {
                          this.selectedRowKey = selectedRowKey;
                          }
                          
                          public RowKeySet getSelectedRowKey() {
                          return selectedRowKey;
                          }
                          
                          public void rowSelected(SelectionEvent selectionEvent)
                          {
                          selectedRowKey = selectionEvent.getAddedSet();
                          
                          if(selectedRowKey.size()>0)
                          {
                          ArrayList rowKeySetItemData;
                          rowKeySetItemData = (ArrayList)selectedRowKey.iterator().next();
                          
                          }
                          
                          }
                          but i got the error :
                          Caused by: java.lang.ClassCastException: java.util.Collections$SingletonList cannot be cast to java.util.ArrayList
                               at ManagedBeanPkg.ManagedBean.rowSelected(ManagedBean.java:91)
                               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                               at java.lang.reflect.Method.invoke(Method.java:597)
                               ... 59 more
                          so i ask any body please help me to solve this problem.

                          thanks

                          Edited by: 842127 on Jan 17, 2013 6:16 AM
                          • 10. Re: TreeTable selfjoin
                            Puthanampatti
                            try this.. https://blogs.oracle.com/jdevotnharvest/entry/how_to_read_data_from
                            • 11. Re: TreeTable selfjoin
                              User268653
                              hi
                              i tried it before and i get same result.

                              thanks
                              maher
                              • 12. Re: TreeTable selfjoin
                                Puthanampatti
                                I think you should put all your code here..someone should be able to help you. I can't help unless I will try the same myself.
                                • 13. Re: TreeTable selfjoin
                                  User268653
                                  hi



                                  i will put it tomorrow .



                                  thanks