So I’ve just tried to move an existing custom widgetset into a new project and it has been an absolute pain.
My first statement would be that it would be really nice if the vaadin documenation team re-did the widget doco from scratch as it really isn’t helpful.
So a couple of things that I found that might help othe people.
- place your components under a common directory called something like widgets.
au.org.noojee.irrigation.widgets
- Place your custom widgets module under the widgets directory.
au.org.noojee.irrigation.widgets
PiGationWidgetset.gwt.xml
- Under the widgets directory create TWO directories for each custom widget. If your widget is called timerLabel then you need two packages.
au.org.noojee.irrigation.widgets.timerLabel
au.org.noojee.irrigation.widgets.client.timerLabel
- the client package (…client.timerLabel) should contain all of you client classes:
au.org.noojee.irrigation.widgets.client.timerLabel
TimerLabelClientRpc.java
TimerLableconnector.java
TimerLableMode.java
TimerLabelServerRpc.java
TimerLabelState.java
TimerLabelWidget.java
- the server side class should live in the …/widgets.timerLabel package
au.org.noojee.irrigation.widgets.timerLabel
TimerLableComponent.java
- Add an @Widget annotation to your UI class. The annotation needs the full path to your .gwt.xml file so:
The other annotations shown below have nothing to do with widgets but I’ve left them there for context.
@Theme("mytheme")
@Viewport("width=device-width, initial-scale=1.0")
@PushStateNavigation
@Push
@Widgetset("au.org.noojee.irrigation.widgets.PiGationWidgetset")
public class ControllerUI extends UI
{
- do a full clean and build each time you change your configuration:
mvn clean
mvn install
You need to tell eclipse to refresh its project view after doing a maven build. You can also use the eclipse vaadin plugin to build the widget, but when in doubt I do the above maven commands.
- If you change your widgets set or the path to your widget set MAKE CERTAIN to HARD RELOAD your browser CACHE otherwise it will keep asking for/using the old one.
The above examples are based on an open source project I’m working so you can reference the full code here:
https://github.com/bsutton/IrrigationForPi
Hope you find this useful.