Openlayers 3 wrapper for GWT

I could deploy properly the OpenLayers 3 Wrapper for Vaadin 7, but I cannot do the same with this OpenLayers 3 Wrapper for GWT. After several configurations I have this error when accesing the web (running as a GWT 2.7.0 project)…

com.google.gwt.core.client.JavaScriptException: (TypeError) @org.vaadin.gwtol3.client.source.ImageWMSSource::create(Lorg/vaadin/gwtol3/client/source/ImageWMSSourceOptions;)([JavaScript object(9)]
): invalid ‘in’ operand b

…when trying to execute this line:

ImageWMSSource wmssource = ImageWMSSource.create(options);

Is there any gwt-ol3-demo github project as v-ol3-demo where I can see how to deploy and run properly this add-on?

Any help will be appreciated,
Many thanks in advance,

Cheers,
Ruben

Hello Ruben,

Unfortunately there is no demo available for the GWT part. Please provide the code where you create the options for the source. Also have a look at:

https://github.com/VOL3/v-ol3/blob/master/v-ol3/src/test/java/org/vaadin/addon/vol3/demoandtestapp/ImageWMSMap.java

Even though the code is for the vaadin api, the configuration parameters for the source should be more or less the same. For the GWT-part you might also take a look at

https://github.com/VOL3/v-ol3/blob/master/v-ol3/src/main/java/org/vaadin/addon/vol3/client/source/OLImageWMSSourceConnector.java which creates the same source using GWT.

Cheers,
Matti

Hi Matti,

The code where I create the options is the following:

    ImageWMSSourceOptions options = ImageWMSSourceOptions.create();
    options.setCrossOrigin("");
    options.setServerType("geoserver");
    options.setUrl("http://myserver/geoserver/wms");

    ParameterLayer pl = (ParameterLayer)JavaScriptObject.createObject().cast();
    pl.setAttribute("LAYERS");
    pl.setValue("PSA:mylayer");   
    JsArray<ParameterLayer> params = JavaScriptObject.createArray().cast();
    params.push(pl);
  
    options.setParams(params);  
    ImageWMSSource wmssource = ImageWMSSource.create(options);

In addtion, I don’t know if I am creating the params options properly, is it correct? since the code changes slightly from vaading wrapper, anyway, code is not working even without options.

I’d like also to know how a AppWidgetSetgwt.xml should be created, since when I compile it, some inherits (such as ) disappear from this file (I guess due to update-wigset goal at pom.xml), and only remains this → . I tried to delete that goal but the result is the same. What’s wrong with that?

Many thanks for your support.
Cheers,
Ruben

I don’t think the params options is created correctly. See the com.vaadin.client.FastStringMap in order to see how you should do it. The code does not work without options - I think it wouldn’t work either when using the pure javascript version of the OpenLayers library. Naturally you need to tell to the image source how it should fetch its data.

For the GWT-specific part, I can not really help you. It seems you are compiling your GWT project and you also have the vaadin client-side libs in your classpath? Is that on purpose? This is not a requirement for the gwt-ol wrapper anyway.

Hope this helps and sorry for the late answer. It is summer vacation season here in Finland.

Best regards,
Matti

Sorry for delaying on my answer.I was too busy these past days. Thanks a lot for your support, Matti. I’ve finally used OL3 wrapper over Vaadin rather than GWT, implementing manually all related to WFS.

Many thanks anyway!

Cheers,
Ruben