Hi
I have an appLayout which is references in view classes, layout = MainLayout.class
I need to change tab text dynamically. I set tab.getElement().setText(name); in afterNavigation() inside the layout class (mainLayout.class). It works fine on the first load, but somehow prevent navigation after that. How to make this work, is there some better way without loop:
public static void setTabName() {
User user = (User) Utils.getUser();
if(myiUser!=null) {
for(int i=0;i<menu.getComponentCount();i++) {
Component component=menu.getComponentAt(i);
if(component instanceof Tab) {
Tab tab=(Tab)component;
Optional<String> id=tab.getId();
if(id.isPresent() && id.get().equals(ViewConstant.VIEW_NAME.toString())) {
String text=user.getText();
tab.getElement().setText(text);
}
}
}
}
}