Re: New Presentation about Modern GWT Webapp Development

2020-05-12 Thread Dr. Lofi Dewanto
Hi Thomas,

thanks a lot for the review. I updated following:

(1) Slide 18: updated with your content

(2) Slide 20: I let the slide 20 the same but I inserted a slide 23, which 
said "... more than two connections..."

(2.1) I also add a slide 24 about 

Re: JsInterop - fail to iterate @JsType in List

2020-05-12 Thread Colin Alworth
Another option could be to tell GWT that this is just the idea of what the 
Car type will be, but that there isn't actually a real type called Car that 
it will be able to find. For example, you could perhaps make this an 
interface instead of a class (js has no actual interface types, just "it 
quacks, so its a duck"). Another option (but not a good one) is to further 
modify the `@JsType` to have `name="Object", so that GWT ignores all type 
checks. This will get weird in j2cl though, as you'll need externs that 
reflect this code style (though you'll need externs anyway, if monaco isn't 
capable of being fed to closure-compiler).

I do believe that the es2015 class keyword emits a constructor that GWT can 
work with though - the limitations for GWT and WebComponents are that you 
can't "extend" a es2015 class using prototype, and GWT always uses 
prototype. 

If the script block does some scoping (modules perhaps?) that could hide 
the Car type from GWT, so that it is unable to do the JS `(c instanceof 
$wnd.Car)` check required to cast the element when it comes out of the 
generic ArrayList.get().

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/c8f20354-7b33-4285-881c-521b44896dee%40googlegroups.com.


Re: New Presentation about Modern GWT Webapp Development

2020-05-12 Thread Thomas Broyer
Great deck, there are a few inaccuracies though:

   - Slide 18:  “Most browsers will allow a maximum of two simultaneous 
   connections for fetching resources.” This has been wrong for some time; 
   limit has been bumped to 6 since IE8, Firefox 3.6 (
   
https://developer.mozilla.org/en-US/docs/Web/HTTP/Connection_management_in_HTTP_1.x#Domain_sharding
   , https://hpbn.co/http1x/#using-multiple-tcp-connections, 
   https://en.wikipedia.org/wiki/HTTP_persistent_connection#Use_in_web_browsers
   , http://www.stevesouders.com/blog/2008/03/10/ie8-speeds-things-up/, 
   
http://kb.mozillazine.org/Network.http.max-persistent-connections-per-server), 
   I've even found a resource stating that IE11 used up to 13 connections (
   
https://docs.pushtechnology.com/cloud/latest/manual/html/designguide/solution/support/connection_limitations.html
   )
   - Slide 20: I'm pretty sure modern browsers will start to fetch 
   bigImageOne and reallyBigImageTwo in parallel to externalScriptZero (see 
   https://developer.mozilla.org/en-US/docs/Glossary/speculative_parsing), 
   and of course the example is tailored for a 2-connection-per-server limit, 
   which is no longer the case. As we're at it, you might also want to talk 
   about 

Re: JsInterop - fail to iterate @JsType in List

2020-05-12 Thread 'Tino D.' via GWT Users
I think you can achieve this by using Babel: https://babeljs.io/ . A lot of 
JS-Libs use this for shipping and "Legacy"-support. See also: 
https://medium.com/hired-engineering/setting-up-monaco-with-jest-e1e4c963ac

Am Dienstag, 12. Mai 2020 12:14:50 UTC+2 schrieb Freddy Boucher:
>
> @Jens
>
> Good catch! It does work with the following javascript:
>
>   
>function Car() {
>  this.start = function () {
>return "start";
>  }
>}
>
> var car = new Car();
>  
>
> But as you guessed, this is just some dummy code, my real javascript is 
> the Microsoft Monaco Editor  and 
> of course I don't have any control on it.
> What is the recommended approach in that case?
>
> Thank you
>
>
> On Tuesday, May 12, 2020 at 7:47:05 PM UTC+10, Jens wrote:
>>
>>
>> Other ideas?
>>>
>>
>> Maybe because you have used a ES6 / ECMAScript2015 class in your custom 
>> JS instead of a traditional function() based JS class. For example web 
>> components also use ES6 classes and it is not straight forward to use them 
>> with JsInterop / GWT.
>>
>> I would start SDM / Compiler with -style PRETTY and look at / debug the 
>> JS to see why a cast exception occurs or try define the class without using 
>> ES6.
>>
>> -- J.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/06ae444e-4dae-4db1-9357-7b79a359e246%40googlegroups.com.


Re: JsInterop - fail to iterate @JsType in List

2020-05-12 Thread Freddy Boucher
@Jens

Good catch! It does work with the following javascript:

  
   function Car() {
 this.start = function () {
   return "start";
 }
   }

var car = new Car();
 

But as you guessed, this is just some dummy code, my real javascript is the 
Microsoft 
Monaco Editor  and of course I 
don't have any control on it.
What is the recommended approach in that case?

Thank you


On Tuesday, May 12, 2020 at 7:47:05 PM UTC+10, Jens wrote:
>
>
> Other ideas?
>>
>
> Maybe because you have used a ES6 / ECMAScript2015 class in your custom JS 
> instead of a traditional function() based JS class. For example web 
> components also use ES6 classes and it is not straight forward to use them 
> with JsInterop / GWT.
>
> I would start SDM / Compiler with -style PRETTY and look at / debug the JS 
> to see why a cast exception occurs or try define the class without using 
> ES6.
>
> -- J.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/273f8598-27e9-474b-8cf5-f6f78b42b6a1%40googlegroups.com.


Re: JsInterop - fail to iterate @JsType in List

2020-05-12 Thread Jens


> Other ideas?
>

Maybe because you have used a ES6 / ECMAScript2015 class in your custom JS 
instead of a traditional function() based JS class. For example web 
components also use ES6 classes and it is not straight forward to use them 
with JsInterop / GWT.

I would start SDM / Compiler with -style PRETTY and look at / debug the JS 
to see why a cast exception occurs or try define the class without using 
ES6.

-- J.


-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/4a503353-16a0-4795-8dd4-9ea2fa14c19a%40googlegroups.com.


Re: JsInterop - fail to iterate @JsType in List

2020-05-12 Thread Freddy Boucher
Thanks @Jens

So I added *namespace = JsPackage.GLOBAL* as suggested:

package com.project.client;

import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public class Car {
 @JsProperty(namespace = JsPackage.GLOBAL) public static Car car;

  public native String start();
}

But the new stacktrace is:

SEVERE: 
java.lang.ClassCastException
  at Unknown.xk_g$(Throwable.java:69)
  at Unknown.el_g$(Exception.java:29)
  at Unknown.ml_g$(RuntimeException.java:29)
  at Unknown.BXe_g$(ClassCastException.java:27)
  at Unknown.dyg_g$(InternalPreconditions.java:154)
  at Unknown.pyg_g$(InternalPreconditions.java:138)
  at Unknown.oyg_g$(InternalPreconditions.java:133)
  at Unknown.c9c_g$(Cast.java:155)
  at Unknown.ose_g$(App.java:74)
  at Unknown.Fse_g$(App.java:66)
  at Unknown.rfb_g$(SchedulerImpl.java:50)
  at Unknown.Xeb_g$(SchedulerImpl.java:183)
  at Unknown.Seb_g$(SchedulerImpl.java:347)
  at Unknown.jfb_g$(SchedulerImpl.java:78)
  at Unknown.Peb_g$(SchedulerImpl.java:141)
  at Unknown.ydb_g$(Impl.java:309)
  at Unknown.Bdb_g$(Impl.java:361)
  at Unknown.anonymous(Impl.java:78)

Other ideas?


On Tuesday, May 12, 2020 at 7:14:33 PM UTC+10, Jens wrote:
>
> I am not 100% sure since I have not used JsInterop for a long time now but 
> I would imagine the following:
>
> Currently GWT will think that your native JS class "Car" is located at 
> com.project.client namespace because that is the package it lives in and 
> you have not provided a namespace to @JsType.
>
> You can access the static car field because you have added the global 
> namespace to @JsProperty and your custom JS has created a car field in that 
> global namespace. In your for-loop I am relatively sure that GWT will try 
> to verify that your Java list contains actual JS Cars so the generated JS 
> will somewhere contain "$wnd.com.project.client.Car" which is undefined 
> since your JS did not define it (you have defined everything in the global 
> space, including the class itself)
>
> So you should use @JsType(isNative = true, namespace = JsPackage.GLOBAL) 
> on your Car class to tell GWT to use $wnd.Car since that is the location 
> where you have defined that class in JS.
>
>
> -- J.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/44bdc332-2540-4393-a650-741877a9ee55%40googlegroups.com.


Re: JsInterop - fail to iterate @JsType in List

2020-05-12 Thread Jens
I am not 100% sure since I have not used JsInterop for a long time now but 
I would imagine the following:

Currently GWT will think that your native JS class "Car" is located at 
com.project.client namespace because that is the package it lives in and 
you have not provided a namespace to @JsType.

You can access the static car field because you have added the global 
namespace to @JsProperty and your custom JS has created a car field in that 
global namespace. In your for-loop I am relatively sure that GWT will try 
to verify that your Java list contains actual JS Cars so the generated JS 
will somewhere contain "$wnd.com.project.client.Car" which is undefined 
since your JS did not define it (you have defined everything in the global 
space, including the class itself)

So you should use @JsType(isNative = true, namespace = JsPackage.GLOBAL) on 
your Car class to tell GWT to use $wnd.Car since that is the location where 
you have defined that class in JS.


-- J.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/1cddca63-75ee-48d1-ad59-ff7bc03b6b6e%40googlegroups.com.


Re: JsInterop - fail to iterate @JsType in List

2020-05-12 Thread Freddy Boucher
So I updated my sample project to remove the try/catch so it will throw the 
JavaScriptException

Logger.getLogger("").info("direct call: " + Car.car.start());
List cars = Arrays.asList(Car.car);
for (Car car : cars) {
  car.start();
}
Logger.getLogger("").info("It never goes here!!");

So here is the code that I've just deployed: 
https://github.com/freddyboucher/gwt-storage-objectify/commit/b0ad562f86deb09ee6bf556b32798116e627f347
And you can experience the issue here: 
https://jsinterop-dot-gwt-storage-objectify.appspot.com/?compiler.stackMode=emulated


On Tuesday, May 12, 2020 at 5:33:22 PM UTC+10, Freddy Boucher wrote:
>
> Hi @Jens
>
> Can be project referring to my package name?
> But I confirm the log is correct and it's produced by this exact sample
>
> package com.project.client;
>
> import jsinterop.annotations.JsPackage;
> import jsinterop.annotations.JsProperty;
> import jsinterop.annotations.JsType;
>
> @JsType(isNative = true)
> public class Car {
>  @JsProperty(namespace = JsPackage.GLOBAL) public static Car car;
>
>   public native String start();
> }
>
>
>
>
> On Tuesday, May 12, 2020 at 5:28:27 PM UTC+10, Jens wrote:
>>
>>
>> But it fails with the following logs:
>>> direct call: start
>>> ConsoleLogger.java:33 FAILED to iterate a @JsType in a List
>>> ConsoleLogger.java:55 Exception: 
>>> com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read 
>>> property 'project' of undefined
>>> ConsoleLogger.java:33 TypeError: Cannot read property 'project' of 
>>> undefined
>>> at dse_g$ (App.java:75)
>>> at tse_g$.use_g$ [as execute_1_g$] (App.java:66)
>>>
>>
>> Where does 'project' come from? Looks like the exception does not match 
>> the example code?
>>
>> -- J. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/ab1463b1-3232-4920-b9f8-ba3d971766e7%40googlegroups.com.


Re: Deploying a GWT website

2020-05-12 Thread Dr. Lofi Dewanto
GWT is a transpiler. At the end the result is just a collection of 
JavaScript + HTML files.

You don't need any buildpacks for this purpose... Just take the 
"index.html" with all the JavaScript files "..cache.js". So generally 
only Tomcat / Jetty / Apache... pure web servers are enough.

Take a look at this presentation: https://bit.ly/gwtintropresentation

Slides from number: 24 - Anatomy of GWT Web Apps... you can see "Result 
JavaScript".

Hope this helps.

>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/2687b916-6a1e-4d83-acce-c1b041dd5dae%40googlegroups.com.


Re: JsInterop - fail to iterate @JsType in List

2020-05-12 Thread Freddy Boucher
Hi @Jens

Can be project referring to my package name?
But I confirm the log is correct and it's produced by this exact sample

package com.project.client;

import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

@JsType(isNative = true)
public class Car {
 @JsProperty(namespace = JsPackage.GLOBAL) public static Car car;

  public native String start();
}




On Tuesday, May 12, 2020 at 5:28:27 PM UTC+10, Jens wrote:
>
>
> But it fails with the following logs:
>> direct call: start
>> ConsoleLogger.java:33 FAILED to iterate a @JsType in a List
>> ConsoleLogger.java:55 Exception: 
>> com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read 
>> property 'project' of undefined
>> ConsoleLogger.java:33 TypeError: Cannot read property 'project' of 
>> undefined
>> at dse_g$ (App.java:75)
>> at tse_g$.use_g$ [as execute_1_g$] (App.java:66)
>>
>
> Where does 'project' come from? Looks like the exception does not match 
> the example code?
>
> -- J. 
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/dfeb5e37-0518-48f5-941e-c852f595aeb5%40googlegroups.com.


Re: JsInterop - fail to iterate @JsType in List

2020-05-12 Thread Jens


> But it fails with the following logs:
> direct call: start
> ConsoleLogger.java:33 FAILED to iterate a @JsType in a List
> ConsoleLogger.java:55 Exception: 
> com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read 
> property 'project' of undefined
> ConsoleLogger.java:33 TypeError: Cannot read property 'project' of 
> undefined
> at dse_g$ (App.java:75)
> at tse_g$.use_g$ [as execute_1_g$] (App.java:66)
>

Where does 'project' come from? Looks like the exception does not match the 
example code?

-- J. 

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/4576e379-7aa6-4bfa-a428-dd409593e66c%40googlegroups.com.


JsInterop - fail to iterate @JsType in List

2020-05-12 Thread Freddy Boucher
Hi,

So I don't know if it's a known JsInterop issue but here is my problem (PS: 
I'm running GWT 2.9.0-RC1):

So in my home page I have the following code:


class Car {
start() {
return "start";
}
}

var car = new Car();


I have the following @JsType:

import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

@JsType(isNative = true)
public class Car {
@JsProperty(namespace = JsPackage.GLOBAL) public static Car car;

public native String start();
}

And I'm just trying the following code:

GWT.log("direct call: " + Car.car.start());
List cars = Arrays.asList(Car.car);
try {
for (Car car : cars) {
car.start();
}
} catch (Exception exception) {
GWT.log("FAILED to iterate a @JsType in a List", exception);
}

But it fails with the following logs:
direct call: start
ConsoleLogger.java:33 FAILED to iterate a @JsType in a List
ConsoleLogger.java:55 Exception: 
com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read 
property 'project' of undefined
ConsoleLogger.java:33 TypeError: Cannot read property 'project' of undefined
at dse_g$ (App.java:75)
at tse_g$.use_g$ [as execute_1_g$] (App.java:66)
at rfb_g$ (SchedulerImpl.java:50)
at Xeb_g$ (SchedulerImpl.java:183)
at Meb_g$.Seb_g$ [as flushPostEventPumpCommands_0_g$] (SchedulerImpl.java:
347)
at ifb_g$.jfb_g$ [as execute_2_g$] (SchedulerImpl.java:78)
at Peb_g$ (SchedulerImpl.java:141)
at ydb_g$ (Impl.java:309)
at Bdb_g$ (Impl.java:361)
at Impl.java:78
at callback_0_g$ (SchedulerImpl.java:196)


I have a small demo project to reproduce the issue: 
https://github.com/freddyboucher/gwt-storage-objectify/commit/e4184b0ccd5bd490b16cbc6bb56b0d33fe6e76d1

Is it a bug or a known limitation of JsType?

Thank you

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/88c54dfb-f071-4fb6-a66e-6f22d0b30f45%40googlegroups.com.