Marthin
Marthin

Reputation: 6543

vaadin TreeTable remove dropdown on parent without children

I'm using vaadin's TreeTable. Is there a way to remove or hide the dropdown arrow on the first level objects that do not have any children and still have the objects correctly positioned vertically?

UPDATE

Final solution if anyone is interested:

I add a FieldFactory to the table

protected class TableFactory extends DefaultFieldFactory{
    private static final long serialVersionUID = 1L;

    private MyTreeTable table;
    public TableFactory(MyTreeTable table){
        this.table = table;
    }

    @Override
    public Field createField(Container container, Object itemId,
            Object propertyId, Component uiContext) {
        Field field = super.createField(container, itemId, propertyId, uiContext);

        if(itemId instanceof TaskHeadRow){
            if(((TaskHeadRow)itemId).getTask() instanceof SystemTask){
                table.setChildrenAllowed(itemId, false);
            }
        }

        return field;
    }   
}

Upvotes: 1

Views: 2111

Answers (1)

Henri Kerola
Henri Kerola

Reputation: 4967

The arrow is not show if you define for the item:

treetable.setChildrenAllowed("myitemid", false);

Upvotes: 3

Related Questions