Tuesday, February 25, 2014

Error in expanding GWT Tree

Hi, in my WebApp I use a GWT Tree. I have made a Button, when you klick this button the whole tree should be expanded / closed.
But when I click the button sometimes a TreeItem does not close. When I debug this I can see that the open state is not changed but I called the method treeItem.setState(open).

So I don't know why this isn't changed in my TreeItem.

Any suggests ? 

Thanks in advance.

Here is my onClick Method:

 public void onClick( ClickEvent event )
    Object source = event.getSource();
    if ( source.equals( getView().getButtonBaumEinAusKlappen() ) )

      for ( int i = 0; i < getView().getTree().getItemCount(); i++ )
        TreeItem myTreeItem = getView().getTree().getItem( i );
          getView().getTree().expandAll( myTreeItem, !expandState );
        myTreeItem.setState( !expandState );
        int andkw = 5;
      expandState = !expandState;

and here is my epandAll method: 

 public void expandAll( TreeItem item, boolean expand )
    for ( int i = 0; i < item.getChildCount(); i++ )

      // do action here
      TreeItem childTreeItem = item.getChild( i );
      childTreeItem.setState( expand );

      // recursive call for current node.
      expandAll( childTreeItem, expand );

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment