Are there any test or suggestions in coding convention for components in Vaadin? I see two choides - simple “composition” approach (with additional block to make it more readable and narrow some variables scope):
this.cityCombo = new ComboBox();
{
this.cityCombo.setWidth("100%");
this.cityCombo.setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_STARTSWITH);
}
and the annonymus-inner-class approach which is more readable and easy, but generates lots of inner classes
this.cityCombo = new ComboBox() {
{
setWidth("100%");
setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_STARTSWITH);
}};
I like the second one as it is very expressive, but I don’t know if making lots of inner classes is a good idea.
What are your opinions ?