1
votes

I'm trying to create a custom widget that will mimic a Navigation Drawer similar to Android / Polymer in Vaadin. However I keep encountering several errors such as:

Widgetset 'X' does not contain implementation for 'Y'. Check its component connector's @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.

I've set up my custom widget in the following file structure, as I read in Ch. 16 of the Book of Vaadin that the file structure requires 'client' package to be at the level of the .gwt.xml:

 src/main/my/domain/core/views/drawerpanel
 |---DrawerPanel.java
 |---DrawerPanelWidgetSet.gwt.xml
 |---client
        |----DrawerPanelClientRpc.java
        |----DrawerPanelConnector.java
        |----DrawerPanelLisetener.java
        |----DrawerPanelServerRpc.java
        |----DrawerPanelState.java
        |----VDrawerPanel.java

However, when Connector is in the client package the compiler keeps complaining about being unable to trace file path for DrawerPanel or unable to find Type DrawerPanel. This can only be resolved by moving the Connector out of client and up to the .gwt.xml level.

Any help is appreciated.

UPDATE

I've moved the DrawerPanel.java to src/main/my/domain/core/views and DrawerPanelWidgetset.gwt.xml to the src/resources directory. It has stopped complaining about the Connector being unable to trace the file path at compile now. Unfortunately, still receiving the Widgetset 'X' does not contain implementation for 'Y' on runtime however.

2

2 Answers

2
votes

To debug this kind of problem, you should first see if DrawerPanelConnector is mentioned at all in the GWT compiler output.

If it is mentioned, the problem may be that the class defined in your @Connect annotation is not the same class that you use on the server. This could be caused e.g. if you by accident import a class with the same name from some other package.

Another potential cause in this case is that you are not using the right widgetset, or that your browser for some reason get an old cached version of it (either cached by the browser or because the newest version isn't deployed to your server). You can trace this by looking at the name of the [hexcode].cache.js file loaded according by your browser (by looking at the network tab in the browser's developer tools) and verifying that the same file is present in the compiler output folder.

If your connector is not mentioned in the log, it is for some reason not picked up by the GWT compiler. This might be e.g. because the class is in a folder that the GWT compiler doesn't look at, because there is no @Connect annotation on the class, or because the connector class (or some other class used by the connector class) contains something that isn't supported by GWT.

To debug this situation, it helps to run the GWT compiler with the -strict option. This makes the compiler treat all discovered problems as errors instead of assuming the class is not intended for client-side usage.

If adding -strict doesn't result in any new error, you should verify that your connector class is at all found by the GWT compiler. You can check this by using some API that is not GWT compatible in your class, e.g. System.load(""). If don't get any error (still with -strict enabled), it means that the compiler never even looks at the class. In that case you would need to verify that your directory structure is correct and that you are actually compiling DrawerPanelWidgetSet.

Finally, if -strict in combination with System.load("") in the code causes an error from the GWT compiler, but leaving out System.load("") makes the compile succeed without the connector class being mentioned in the compiler output, then the only reason I can imagine is that the @Connect annotation is missing from the connector class.

0
votes

The problem with widget compilation is that errors are not clear enough. So you can try to pass -trace to compiler so it will print out more details about what is happening in background.

Be sure to NOT to use primitive types in Connector, State. Also using Short type will cause an error in compiling widget, and the compiler will not show you a clear error.