I’m trying to create a custom GWT component, using the instructions on Creating a GWT component - CUBA Platform. Developer’s Manual. I walked through all of the steps. Now, when I create the RatingScreen controller and try to import
“import com.company.kdodatabase.web.toolkit.ui.RatingFieldServerComponent;”
I get a “Cannot resolve symbol RatingFieldServerComponent” error. I am sure that the RatingFieldServerComponent is in this folder. See screenshot for the error screen and project structure.
Any suggestions what might be going wrong? Thanks.!
Thanks @tsarev, you pointed me in the right direction!
This was a bit confusing for me, as in the documentation example the package references for the server component contained “web.toolkit.ui”: that made me think the files should be in the web-toolkit module.
I made the following changes:
moving RatingFieldServerComponent, RatingFieldServerRpc and RatingFieldState to the web module (I kept RatingFieldConnector and RatingFieldWidget in the web-toolkit module)
changing the package references in the files I move to the web module
adding import statements to the moved files in the RatingFieldConnector
However, when I try to remove the RatingFieldServerRpc and RatingFieldState from the web-toolkit module, I get errors:
[ERROR] Errors in ‘file:/C:/Users/JesseDijkman/StudioProjects/KDOdatabase/modules/web-toolkit/src/com/company/kdodatabase/web/toolkit/ui/client/ratingfield/RatingFieldConnector.java’:
[ERROR] Line 22: No source code is available for type com.company.kdodatabase.web.rating.RatingFieldServerRpc; did you forget to inherit a required module?
[ERROR] Line 29: No source code is available for type com.company.kdodatabase.web.rating.RatingFieldState; did you forget to inherit a required module?
How can I resolve these? Am I correct when moving RatingFieldServerRpc and RatingFieldState to the web module? And if not, how do I reference the web-toolkit classes (when I add an import statement from the web module it doesn’t seem to “see” the web-toolkit module).
Ok done, but now the RatingFieldServerComponent in the web module is complaining about the RatingFieldState: “Cannot resolve symbol ‘RatingFieldState’”. When I try to add an import statement for the RatingFieldState class, the RatingFieldServerComponent doesn’t seem to “see” the web-toolkit module. How do I resolve this issue?
Sorry, I’ve mixed up state and widget. Finally, the web module contains: server component, server RPC and state. The web-toolkit module contains component connector and the widget itself.
I have put the files as you told. However, but still having problems referencing the classes in the web module in the RatingFieldConnector. If I don’t add a reference, the used classes aren’t recognized. If I do add a reference, I’m getting some errors (see screenshot).
A little more info. When I move the Connector and Widget directly into the web-toolkit module (com.company.kdodatabase.web.toolkit.ui), at least the project builds and server can be started. But now, when I open the editor containing the custom GWT component, I get this message (see screenshot). How to resolve this issue? Are the module files I uploaded in my previous comment enough to find the issue? Might be related to: Widgetset does not contain implementation of server component - #2 от пользователя emmett.miller - CUBA.Platform. Thanks.
Sorry, I’m a bit confused. I’ve put the classes where you suggested:
-> In web module: RatingFieldServerComponent, RatingFieldServerRpc, RatingFieldState
-> In web toolkit module: RatingFieldWidget, RatingFieldConnector
Do you mean one or more classes should be put elsewhere? And if so, where should I put what?
I managed to fix it. I’ve put all files in the web toolkit module, structured as you told me. Somehow, when generating the webtoolkit module, a dependency was added for the web module. This should be the other way around, so I can reference the widget in the web toolkit module from the web module. I’ve fixed it and now I’m able to use the widget in my web module.