April 2018
Intermediate to advanced
202 pages
4h 48m
English
To make the menu work, we can implement the addMenuOption(MenuOption, SerializableConsumer<MenuOption>) method as follows:
public class TabBasedApplicationLayout ... { ... private Collection<String> menuButtonStyles = new HashSet<>(); ... @Override public void addMenuOption(MenuOption menuOption, SerializableConsumer<MenuOption> clickListener) { Button button = new Button(menuOption.getCaption(), event -> clickListener.accept(menuOption)); menuButtonStyles.forEach(button::addStyleName); menuLayout.addComponent(button); } ...}
This method iterates over the menuButtonStyles collection to add each style to the new button. Lastly, the methods to set styles for menu options and also for the header should look as follows: ...
Read now
Unlock full access