Sorting CSS Layout alphabetically

Hey Guys,

I just made my first vaadin app and I try to use the CssLayout. I created a Website with a sidebar. For each menu in the sidebar I use an CssLayout Object.
These Objects contain a lot of NativeButtons. Is there a way to oder these Buttons alphabetically by name?
I imagine something like this:

[font=Comic Sans]
[font=Courier New]
private CssLayout test;

private NativeButton button1;
private NativeButton button2;

private void initTest() {
button1 = new NativeButton(“button1”);
test.addComponent(button1);
button2 = new NativeButton(“button2”);
test.addComponent(button2);
// the function I’m looking for should be something like this
test.sort();
[/font]
[/font]
}

Is there anything like that?

Cheers Rolfe

There is not really any way to implement a generic sort() on a layout (should it sort by type (buttons, labels, …), by name, by size, …) so it is left to you to do the sort yourself.
Components in a layout are displayed in the order of addComponent() so if you build the layout in the right order, the output will be sorted.