IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Selected row in tree

    Posted Fri October 10, 2014 09:02 AM

    Hello All,
    I have one tree with structure like…
    –root
    ----------child level1
    -----------------child level2
    -------------------------Element 1
    -------------------------Element 2
    -------------------------Element 3
    -------------------------Element 4

    And I have row selected check box for selecting row.
    Now with click on one command button I want to retrieve selected row details.But not able to get achieve this.
    I have code like this…
    List a=dataTestProvider.getSelectedRows();
    for(int i=0;i<a.size();i++)
    {
    Test g=(Test) a.get(i);//Test is the Object for row class
    System.out.println(“name:”+g.getName());
    }

    But always I am getting error as Can’t be converted to this class.

    Is there any alternative way to read the rows of selected rows in tree…because same code is working in table structure.
    And also working for List a=dataTestProvider.getList(); instead of getSelectedRows();

    Thanks
    Baharul


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 2.  RE: Selected row in tree

    Posted Fri October 10, 2014 01:45 PM

    A couple of questions to refine the problem:

    1. Which tree provider class are you using for your use case?

    2. What type of Object are you getting in the selected rows list?


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 3.  RE: Selected row in tree

    Posted Fri October 10, 2014 03:13 PM

    Below are some details

    private com.webMethods.caf.faces.data.tree.object.NodeTreeContentProvider testProvider = null;

    //Setting data provider as

    public com.webMethods.caf.faces.data.tree.object.NodeTreeContentProvider getTestProvider() {

    	testProvider= new BoundChildrenTreeContentProvider(getTest(),"test" , "#{test.customerId},#{test.orderId},#{test.widgetId}", "#{test.orders},#{test.widgets}");
    return testProvider;
    }
    

    Getting below error when trying to access class

    com.webMethods.caf.faces.data.tree.object.BoundChildrenNode$PermissiveContentProviderWrapper cannot be cast to com.data.Customer


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 4.  RE: Selected row in tree

    Posted Fri October 10, 2014 03:20 PM

    Version used is 8.2
    Please find the attached work space for your reference…

    treeExample10_Oct.zip (40.7 KB)


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 5.  RE: Selected row in tree

    Posted Fri October 10, 2014 03:25 PM

    Ok. The BoundChildrenTreeContentProvider wraps your row objects with another object to adapt them to a format suitable for the tree.

    You can retrieve the original object from the wrapper with something like this:

    //the row is the wrapper object
    BoundChildrenNode$PermissiveContentProviderWrapper wrapper = (BoundChildrenNode$PermissiveContentProviderWrapper)a.get(i);
    
    //get the original object that was wrapped. 
    Test g=(Test) wrapper.getObject();//Test is the Object for row class 

    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 6.  RE: Selected row in tree

    Posted Fri October 10, 2014 11:42 PM

    But BoundChildrenNode$PermissiveContentProviderWrapper is not getting to resolve to a type.

    Is there any documentation available for this.


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 7.  RE: Selected row in tree

    Posted Sat October 11, 2014 12:55 AM

    Thanks Eric for your reply.

    This is get solved in some way.

    PermissiveContentProviderWrapper wrapper=(PermissiveContentProviderWrapper) a.get(i);
    Test g=(Test) wrapper.getObject();

    Here I am able to get selected row details.

    Now facing problem here is to add the selected row again to Tree/TreeProvider with some editted contents.

    when trying to use methods treeProvider.createRow() …getting one error like
    com.data.Customer cannot be cast to com.webMethods.caf.faces.data.tree.INode.


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods