Hi,
I trying to bind a Container to a Tree and I can’t get the click listener to work when I make my own implementation of niether a extended HierarchicalContainer or a Container wich implements Container.Hierarchical.
The tree is rendering and I can expand and close leafs, I get descriptions and I can add Actions to the items.
But I really can’t get the click ItemClickListener and Action.Handler implementation events to kick in.
It works when I instansiate a HierarcialContainer in the init() method and assign the items, it also works when I assign the the Tree items directly. But if I instansiate my own implementations without injections even then I can’t get the click listener to work…
It feels like I oversee something here… Any Ideas?
(Tested Vaadin 7.3.7 and 7.4.0alpha and wildfly 8.2
[code]
public class WelcomePanel extends Panel implements ItemClickEvent.ItemClickListener {
@Inject
@UIScoped
// Test container 1
TestContainer contentContainer;
@Inject
@UIScoped
// Test Container 2
HContainer hContainer;
@PostConstruct
private void init() {
final VerticalLayout layout = new VerticalLayout();
setContent(layout);
Tree tree1 = new Tree(“Test”, contentContainer);
// Works
/*
HierarchicalContainer hierarchicalContainer = new HierarchicalContainer();
hierarchicalContainer.addItem(“Test1”);
hierarchicalContainer.addItem(“Test2”);
hierarchicalContainer.addItem(“Test3”);
*/
//tree1.setContainerDataSource(hierarchicalContainer);
//Works
//tree1.addItem(“Item 1”);
//tree1.addItem(“Item 2”);
tree1.addItemClickListener( this );
tree1.setNullSelectionAllowed( false );
layout.addComponents( tree1 );
}
public void itemClick( ItemClickEvent event ) {
if ( event.isDoubleClick() ) {
Notification.show("DOUBLE CLICK! : " + event.getItemId());
} else {
Notification.show("OTHER CLICK! : " + event.getItemId());
}
}
}
[/code]/Regards Per Jonsson