Dynamically changing items in menu


How do you dynamically change the items in the menu when something is selected in the vaadin tree? I have embedded a vaadin application with div and I would like to know how can you dynamically change the contents of the menu item if some items are selected in a vaadin tree.

I am not exactly sure what do you mean by
"I have embedded a

application with div" would you please elaborate more on the real Problem.

In a normal scenario, you would do it in Server-Side in your normal java-code. Tree-ItemClick-Listener and updating the Menu/MenuItem.

Sorry for not elaborating enough. Vaadin application is embedded using div tag, that’s what I mean.

I would like to take control of my “views”. So the menu is written using plain JS, CSS etc. and there is a Vaadin app (v-app) from Vaadin that is embedded using div tag inside my view. Now the problem I am facing is how do you talk between a simple JS menu and Vaadin tree navigation.

I hope you understood what I meant.

It might be possible using/creating a Javascript component.(?)
like here

This way you could communicate to your client JS from Vaadin.
Another possibility might be PageOne.getJavascript().execute a script which dynamically change the JS,CSS menu.