Search code examples
javavaadinextendconnector

Compile a class in a Vaadin widgetset


I tried to follow this tutorial to extend one of my component : https://vaadin.com/blog/-/blogs/2656782

I created both classes ResetButtonForTextField and ResetButtonForTextFieldConnector that I put in com.myproject.widgetset.extendedComponents in src/main/java in my WidgetSet project.

After compilation (the widgetset is also compiled) and adding in my code :

TextField tf = new TextField();

ResetButtonForTextField.extend(tf);

It seems like the extend is not working because I put heaps of logs in the ResetButtonForTextFieldConnector class and nothing is displayed in my app logs when I'm using the textfield. I think it's cause of the ResetButtonForTextFieldConnector isn't compiled when the widgetset is compiling because I saw that at the end of the tutorial : "An extension connector needs to be included in a widget set. The class must therefore be defined under the client package of a widget set, just like with component connectors."

So I probably forgot something or maybe I'm doing something wrong that's why I'm asking for help here because I'm stuck !

If anybody could help or advice me :) Thanks,

Tom


Solution

  • It's a bit of a gotcha, but you're on the right track. The client-side stuff actually needs to be under a package called client. So you could use for example com.myproject.widgetset.extendedComponents for server side and gwt.xml and com.myproject.widgetset.extendedComponents.client for client-side stuff.