Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Put component into Grid cell

Konrad Przydział
7 years ago Aug 18, 2015 6:16am
Patrik Lindström
7 years ago Aug 18, 2015 7:22am
Konrad Przydział
7 years ago Aug 18, 2015 7:39am
Marius Reinwald
7 years ago Aug 18, 2015 8:53am

As you're trying to display Widgets like a ToogleMenu you should probably extend WidgetRenderer as you can define exactly what kind of Widget you want to display and how to handle its events.
This is not a trivial task though but it is doable. There also aren't really any good example. The only thing I know is a bit of code i made to display TextFields in a Grid that store the new Values on ValueChange. Code can be found here: https://vaadin.com/forum#!/thread/10495424/10511744

Konrad Przydział
7 years ago Aug 18, 2015 9:40am
Marius Reinwald
7 years ago Aug 19, 2015 8:05am

implements Renderer is not necessary here. As are most of the @Overrides that you have in there.
The problem here probably is that you're trying to use server-side components while the Renderer should be defined with client-side/GWT widgets. See that i used TextBox instead of TextField in my example Renderer (TextField being the Vaadin server-side component and TextBox being the GWT "equivalent")

The client-side widgets of Vaadin component are normally called "V"+the components name so it would be something like VMenuBar for your example though i'm not entirely sure that it'll work as you expect it.

Also to get events back to the server-side you have to use a ServerRPC (look in the Vaadin 7 wiki for examples on that). Your EventBus will probably not work on the client-side if its defined on the server.

Additional note: Client-side classes have to be in the client package below the widgetset so if you have your widgetset.gwt.xml in com.example.widgetset your client side classes (such as the WidgetRenderer and the connector) need to be in com.example.widgetset.client .