Remove arrows in Tree for leafs


I know that I’m not the first person who asked this but all the solution I’ve found here in the forum and on nother places in the net don’t work.
I’ve tried it with the ItemStyleGenerator and with setChildrenAllowed.

The arrow is always there.

I am using vaadin 7.3.10 and the Tree with a JPAContainer.

A small code example were really great.


A very quick-and-dirty example, doesn’t cover even nearly all use cases:

        Tree tree = new Tree("TestTree", jpaContainer) {

            public Item addItem(Object itemId) {
                Item item = super.addItem(itemId);
                setChildrenAllowed(itemId, false);
                return item;

            public boolean setParent(Object itemId, Object newParentId) {
                setChildrenAllowed(newParentId, true);
                return super.setParent(itemId, newParentId);


I tried your example but the arrows are still on every item visible.


In that case, you could try extending your JPAContainer and overriding method areChildrenAllowed(Object) there.

Thanks for your answers but I tried a lot with JPAContainer also and I can not get it work…

For me it is a little bit strange that this “normal” behavior for a tree is not standard in vaadin (other things work like a charm in vaadin).


The arrows indicate that it’s possible to add children to that item, whether or not there are any. I tested that with a JPAContainer with overridden areChildrenAllowed(Object) and it worked, so possibly you are doing something different there. Difficult to guess what it might be without seeing your code.

I am now at a diffrent computer (home) - when you tested it with a JPAContainer can you post the part with overriding areChildrenAllowed?

At the moment I create the JPAContainer with JPAContainerfactory.make - maybe I have to doit in a different way.

I am new to vaadin and check if we can use it for our new project and to decide I go through a list of needs we have.

It’s just a simple

return super.areChildrenAllowed(itemId) && getItem(itemId).getEntity().hasChildren(); although of course that requires the entity to have such method. My JPAContainer is created with

new JPAContainer(MyEntity.class); with entityProvider and parent property set later.

If you are still evaluating your options you might also want to take a look at
, which can also handle JPA.

Okay I will start my next try tomorrow. I tried to create the JPAContainer without the Factory but then I run into exception because of the EntityProvider dosen’t work.

I will try it tomorrow and post my code if it dosen’t work.

Thanks for now

So - I tired it from scratch on my MacBook and now it works.

Thanks for your help


Glad to hear it :slight_smile: