Search code examples
gwtpager

CellTree "Show More" programmatically


does anyone know how to trigger the "Show More" functionality of a GWT CellTree programmatically, without having to click on the Show More button?

My aim is to implement a kind of pager that increments the number of elements displayed when the user scrolls down a ScollPanel, so it would be something like:

//inside pager class

onScroll(ScrollEvent)
{

    //here I would call CellTree's show more

}

I've been looking the CellTree and CellTreeNodeView classes code but I couldn't find a clear way to do it.

I know the class CellTreeNodeView has a showMore function which is the one who performs this action, but I don't know how to get it called from another class. I'd need a CellTreeNodeView object, and dont' know how to get it.

Thanks!


Solution

  • It is a package protected method in a package protected class CellTreeNodeView i.e only code in com.google.gwt.user.cellview.client can invoke it.

      void showMore() 
    

    Extremely hacky solution

    1) The only way around it is . Copy CellTreeNodeView and CellTree into your code base (maintain the package )

    2) Change the accessors to public to allow you to invoke showMore as per your requirement.

    3) Ensure you test for all possible flows.

    4) Ensure the copied classes in your code base appear in a higher classpath hieararchy to GWT Compiler than gwt-user jar thus ensuring your modified classes get picked up rather than original ones.