I want to reach the following: A dialog contains a layout with a tab bar, that in turn contains the component containers for each tab.
private final Map<Tab, Component> tabComponentMap = new LinkedHashMap<>();
public DialogLayout()
{
super();
this.initUI();
final Tabs tabs = this.createTabs();
final Div contentContainer = new Div();
this.addComponentAtIndex(1, tabs);
this.addComponentAtIndex(2, contentContainer);
tabs.addSelectedChangeListener(e -> {
contentContainer.removeAll();
contentContainer.add(this.tabComponentMap.get(e.getSelectedTab()));
});
contentContainer.add(this.tabComponentMap.get(tabs.getSelectedTab()));
}
private Tabs createTabs()
{
this.tabComponentMap.put(new Tab("1"), new View1());
this.tabComponentMap.put(new Tab("2"), new View2());
this.tabComponentMap.put(new Tab("3"), new View3());
return new Tabs(this.tabComponentMap.keySet().toArray(new Tab[]{}));
}
When i open the dialog Tab 1 should be open (that's default). There are two button in each View (back/next) that effect the navigation between the tabs. So if I'm in Tab1 with View1 and click next, Tab2 with View2 in it opens and so on. If possible the dialog should remain intact so only the tabs change. How do i accomplish this goal and what do the button click events in each View need to contain? I don't know how to access the tabs in the DialogLayout from the respective View.