Sunday, July 28, 2013

GWT - Tree - Replace the cross event by clicking on the parent item

Hello, I want to replace the cross event by clicking on the parent item: It is possible to open the menu on click on the treeitem parent (like click on the little cross on the left)?

Concretely in the example below, by clicking on "Item 1" will open the menu, by clicking a second time closes the menu.

Is there a solution?

String[] composers = new String[]{"Item 1","Item 2","Item 3"};    Resources treeResource = GWT.create(TreeResources.class);     Tree staticTree = new Tree(treeResource);    TreeItem item1 = staticTree.addTextItem(composers[0]);              TreeItem item2 = staticTree.addTextItem(composers[1]);    // add sub items  addItemSection(item1, "item 1 - 1",new String[]{});  addItemSection(item1, "item 1 - 2", new String[]{});    addItemSection(item2, "item 2 - 1",new String[]{});  addItemSection(item2, "item 2 - 2", new String[]{});  addItemSection(item2, "item 2 - 3", new String[]{});    TreeItem item = new TreeItem();  item1.addItem(item);  item2.addItem(item);    Tree t = new Tree();  t.addItem(item1);  t.addItem(item2);    private void addItemSection(TreeItem parent, String label, String[] composerWorks)   {     TreeItem section = parent.addTextItem(label);               for (String work : composerWorks) {      section.addTextItem(work);     }  }

The result:

  + Item 1
Item 1-1

ANd it would be nice if could hide the cross in the left.

Thanks in advance

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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment