The caption of the tree isn’t taken into account when calculating height, or something else is the problem, such as it doesn’t show up in certain circumstances. As i don’t believe it to be a feature, then it must be a bug.
I attached a war for your convenience to import in eclipse or deploy on tomcat.
The problem is fixable by putting it inside a panel, or layout, but that needs an extra panel, or layout… of course.
VerticalLayout vlayout = new VerticalLayout();
vlayout.addComponent(new FilterTree());
setFirstComponent(vlayout);
The responsibility of drawing captions is in fact the layout’s containing the component, not the component’s. There will probably be no caption even if you change the tree to a textfield with a caption, or anything else for that matter. The caption is visible when you wrap your tree inside a Panel because the Panel’s VerticalLayout takes care of rendering the caption. A VerticalLayout directly instead of Panel should work as well.
I thought that all panels had a inner layout wrapped inside them, but I can’t find any indication of those in SplitPanel(I thought there were too). Maybe SplitPanel and Panel hasn’t got as much in common as I thought. However, I don’t really know which layout I should blame here, so maybe someone knowing the internals of Vaadin better could pitch in.
Jens got it right: SplitPanel does not include any additional layouts inside it. SplitPanel is actually a layout itself (and not an extension of Panel. Bad naming I guess).
And SplitPanel does not take care of captions, so that’s why it is not showing. Currently, this is considered a “feature”, but feel free to post an enhancement ticket about it if you feel it’s important
If it’s a layout maybe it should be called SplitLayout.
And also because it’s a layout, it should take care of layouting.
Also, many things are considered features on the developer team but bugs by the clients, which tend to be always right.
“Inconsistent behaviour annoys users”, think i read that as back as Charles Petzold’s “Programming Windows 98”.
Well, on the other hand, SplitPanel supports scrolling, which no other layout supports, which would make it more of a panel. It is debatable which one it is.
Some layouts leave certain features away that other support, like CSSLayout for example. This layout is heavily used just because of this reason. Leaving out some of the features makes it way more faster to render. Supporting and not supporting the features is a trade-off. Personally I haven’t even noticed that the splitpanel is missing this feature in the 2,5 years I’ve been working with Vaadin. The most usual cases for a splitpanel is that you either put one component in the department, when the component should be self-explanatory without a caption, or then you put in a complex layout in it, that supports all the bells and whistles.
Split panel doesn’t add a scroll bar for second component as seen in the picture below:
EDIT: SOLVED: Actually it does if the content has a defined size, for instance an undefined size layout.