Vaadin 7.x is getComponentIterator()deprecated. Therefore, @eeq's answer is deprecated.
In a new way, his solution may look like this:
Iterator<Component> iterator = tabSheet.iterator();
while (iterator.hasNext()) {
Component component = iterator.next();
TabSheet.Tab tab = tabSheet.getTab(component);
if ("some tab caption".equals(tab.getCaption())) {
}
}
But since TabSheet implements java.lang.Iterable<Component>, it might also look like this:
for (Component component : tabSheet) {
TabSheet.Tab tab = tabSheet.getTab(component);
if ("some tab caption".equals(tab.getCaption())) {
}
}
Or even in Java 8 style:
tabSheet.iterator().forEachRemaining(component -> {
if ("some".equals(tabSheet.getTab(component).getCaption())) {
}
});
source
share