• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Expand and Fold GWT Tree

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I am having difficulty with Expanding and Folding the GWT Tree.

When user selects TreeItem with a mouse click I want the Tree to expand. And when user clicks on TreeItem again I want the Tree to Fold. The problem is that if I click on TreeItem when Tree is unfolded it Folds, and then immediately unfolds again. Looks like SelectionEvent is triggered twice . Here is my code:


public void onSelection(SelectionEvent<TreeItem> event) {
TreeItem t = event.getSelectedItem();
boolean isOpen = t.getState();

if(isOpen)
{
t.setState(false);

} else {
t.setState(true);
}
});

Please advise me...

Thank you.
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Try this

webpage

BOB..


 
Sergey Kargopolov
Ranch Hand
Posts: 63
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rakesh, thank you very much for your post.

I am sorry, may be I did not describe my problem clear enough but I cannot find an example that folds and unfolds GWT Tree by selecting or clicking on Tree Item. I cannot find SelectionEvent example. Clicking on "+" is not what I am interested in. I need Tree to unfold and fold when users clicks on TreeItem. Code that I posted above does not work as I expect it to work. An event is triggered twice.

Thank you.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any help on this, why an event is triggered twice onselection method
 
Greenhorn
Posts: 10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look after the content of the event. Maybe the click event also triggers the select event (2 calls, select + click). I develop only in gxt, with a different event handling, but there more than 1 way to catch events. Is there something similar to addListener(Events.OnSelect, new ..listener()); in GWT?
 
dayananda veerappa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you so much for replay, tree don't have addListener(Events.OnSelect, new ..listener()); method,
can you post sample code for gxt. thanks inadvance
 
Daniel Renner
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nah, you dont need the gxt code. It doesnt help you.
So can you please post the code where you define the listener for the tree (method)? Which gwt version do you use?
 
Seriously Rick? Seriously? You might as well just read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic