CompileWidgets :No source code is available for xx.yyy; did you forget to inherit a required module?

Hi Team,

I am creating a custom widget, If the widget code includes some class from jar , the compileWidgets task will fail.
I have no experience in creating widgets, please suggest.

Ray

Hello Ray!

Java code that is used in GWT module is translated to JavaScript code. When you use 3rd party library in this module it may not translate to JavaScript unless you provide the sources which is impossible for third party.
Or, for instance, add a GWT module that provides the same functionality. In this case, you should inherit your module like you did it for Jmix widgets:

<module>
    <inherits name="io.jmix.ui.widget.WidgetSet"/>
    <inherits name="third.party.library.widget.WidgetSet"/>
</module>
1 Like

Hi @pinyazhin,
Thanks for your replication.
Yes, I use a 3rd part library, I can get the full source code, the library is very simple and no any other decencies. In this case, how to resolve the problem. It’s difficult to find a 3rd GWT module for caculating China Lunar date.

Probably, you still have to convert the library to GWT module for translating it to JavaScript.
Unfortunately, I didn’t have an experience in creating GWT library, so I found some links that may be useful:

  1. GWT docs :: DevGuideOrganizingProjects
  2. java - Using 3rd party libraries with GWT on client side? - Stack Overflow

The last option is to place library source code to your add-on, but of course it is not good way.

1 Like

Looks it’s difficult.
There is a JavaScript library that implement the same functionality I can use.
Is it possible to use the JavaScript library in GWT Widget? Maybe it’s simpler.

Hi @pinyazhin ,

I think I get a better solution.
[GWT] Documentation - JavaScript: JSNI (gwtproject.org)

Calling JS code from GWT Widget.

Following is my code, it works.

public class MyJmixSimpleDayCell extends JmixSimpleDayCell {
    public static native void alert(String msg) /*-{
      $wnd.alert(msg);
     }-*/;

    @Override
    public void setDate(Date date) {
        super.setDate(date);
        alert("d");
    }

}

Thank you .

1 Like