Cannot create HybridMenu in Vaadin 10 project

I’m trying to use HybridMenu in my V10 app but I can’t work out how to create one. The code sample shows the use of HybridMenuBuilder but I have looked in the Java doc for 3.0.15.vaadin10 and I can’t see it there. I have looked in pretty much all the other classes and I can’t see any method that returns a HybridMenu. Sorry for being so dim. Can anyone give me a clue as to how I would create a HybridMenu using Vaadin 10.

Thanks very much.

Just extends your class with HybridMenu, in the official Hybrid menu repository you can find an example:

https://gitlab.com/KaesDingeling/Hybrid-Menu/blob/vaadin10/HM-Demo/src/main/java/de/kaesdingeling/hybridmenu/demo/DemoRouterLayout.java

There is a demo project in the add-on sources, you can use that as a sample: https://gitlab.com/KaesDingeling/Hybrid-Menu/tree/vaadin10/HM-Demo/src/main/java/de/kaesdingeling/hybridmenu/demo . It looks like you don’t add a HybridMenu object to your application but instead you create a root layout extending HybridMenu and you put that as the parent layout of the views.

-Olli

Thank you for the pointers. I have now had a chance to make some progress. I need to make the menus based on entries in a DB table. I’m wondering how to pass that (the repository class references?) to the init() method. I did create a constructor with no parameters (as an experiment) and that does get called before init() but the base class (HybridMenu) no parameter constructor is called first and that calls init(). Perhaps I need to pass them via the init parameters (VaadinSession vaadinSession, UI ui), or maybe there is a better pattern …

Views welcomes, thanks in advance.
-Mark.

Ah just made some more progress. I returned false from init() and then added a readMenus() method passing the repositories to build the menus, calling build() at the end. The menus now appear (there are bugs to fix).

-Mark.

Nice!