[gwt-contrib] Re: Elemental2 1.0.0-beta-1 and casting behaves unexpectedly

2017-05-31 Thread Daniel Harezlak
The way to work around it is to use a native method:

private static native HTMLDocument getHtmlDocument(HTMLIFrameElement frame) 
/*-{
return frame.contentDocument;
}-*/;

Is this required?

On Wednesday, May 31, 2017 at 8:23:20 AM UTC+2, Daniel Harezlak wrote:
>
> Hi, I have the following code using elemental2-dom:
>
> HTMLIFrameElement frame = (HTMLIFrameElement) DomGlobal.document.
> createElement("iframe");
> HTMLDocument doc = (HTMLDocument) frame.contentDocument; //throws 
> java.lang.ClassCastException
>
> The second line throws an exception although I am quite sure that the 
> returned element is an HTMLDocument because when I log it in the JS 
> console I get "[object HTMLDocument]". The first line works fine. What is 
> strange the exception is only thrown in Chrome both in SDM and production 
> modes. In Firefox it works just fine. Any thoughts?
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/a2ffeb54-25fe-446d-af11-47aee2a9e4d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] Re: Elemental2 1.0.0-beta-1 and casting behaves unexpectedly

2017-05-31 Thread gwttechg
How about using jsinterop.base.Js.cast() for the casing instead? - see: 
https://groups.google.com/forum/#!topic/Google-Web-Toolkit/0XGv7EhDFmc

On Wednesday, May 31, 2017 at 7:23:20 AM UTC+1, Daniel Harezlak wrote:
>
> Hi, I have the following code using elemental2-dom:
>
> HTMLIFrameElement frame = (HTMLIFrameElement) DomGlobal.document.
> createElement("iframe");
> HTMLDocument doc = (HTMLDocument) frame.contentDocument; //throws 
> java.lang.ClassCastException
>
> The second line throws an exception although I am quite sure that the 
> returned element is an HTMLDocument because when I log it in the JS 
> console I get "[object HTMLDocument]". The first line works fine. What is 
> strange the exception is only thrown in Chrome both in SDM and production 
> modes. In Firefox it works just fine. Any thoughts?
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/2941325b-7f2c-4267-9162-cddb8daec679%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] Re: Elemental2 1.0.0-beta-1 and casting behaves unexpectedly

2017-05-31 Thread Kirill Prazdnikov
Hi, I have the same issue and use the same JSNI hack
It is interesting why 
GWT does runtime type checks for @JsType(isNative = true) ?
Why is it reasonable ?

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/d5917085-d1b1-49b2-bc8e-0b1e2c72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gwt-contrib] Digest for google-web-toolkit-contributors@googlegroups.com - 5 updates in 2 topics

2017-05-31 Thread Arnaud TOURNIER
About the iframe instanceof problem, I think this is due to the fact that
JavaScript prototypes do not cross frame boundaries (for security and
privacy reasons). So even in JavaScript, the instanceof operator would not
work.

You can try this example :








let frame = document.querySelector("#frame");
let doc = frame.contentDocument;

let a = doc instanceof HTMLDocument;

console.log(`reality check : ${a}`);





If the HTMLDocument class would have @JsType( isNative=true,
namespace=JsPackage.GLOBAL, name="Object" ) annotation, the above snippet
would have worked as expected.

The suggested work around (jsni method) might work, the idea is to bypass
the GWT compiler generated cast checks.

Thanks

Arnaud



Le mer. 31 mai 2017 à 12:47, <
google-web-toolkit-contributors@googlegroups.com> a écrit :

> google-web-toolkit-contributors@googlegroups.com
> 
>  Google
> Groups
> 
> 
> Topic digest
> View all topics
> 
>
>- Elemental2 1.0.0-beta-1 and casting behaves unexpectedly
><#m_-2436713973876021791_m_7201606050167563021_group_thread_0> - 3
>Updates
>- Elemental2 source code on github
><#m_-2436713973876021791_m_7201606050167563021_group_thread_1> - 2
>Updates
>
> Elemental2 1.0.0-beta-1 and casting behaves unexpectedly
> 
> Daniel Harezlak : May 30 11:23PM -0700
>
> Hi, I have the following code using elemental2-dom:
>
> HTMLIFrameElement frame = (HTMLIFrameElement) DomGlobal.document.
> createElement("iframe");
> HTMLDocument doc = (HTMLDocument) frame.contentDocument; //throws
> java.lang.ClassCastException
>
> The second line throws an exception although I am quite sure that the
> returned element is an HTMLDocument because when I log it in the JS
> console
> I get "[object HTMLDocument]". The first line works fine. What is strange
> the exception is only thrown in Chrome both in SDM and production modes.
> In
> Firefox it works just fine. Any thoughts?
> Daniel Harezlak : May 31 12:25AM -0700
>
> The way to work around it is to use a native method:
>
> private static native HTMLDocument getHtmlDocument(HTMLIFrameElement
> frame)
> /*-{
> return frame.contentDocument;
> }-*/;
>
> Is this required?
>
> On Wednesday, May 31, 2017 at 8:23:20 AM UTC+2, Daniel Harezlak wrote:
> gwtte...@gmail.com: May 31 02:19AM -0700
>
> How about using jsinterop.base.Js.cast() for the casing instead? - see:
> https://groups.google.com/forum/#!topic/Google-Web-Toolkit/0XGv7EhDFmc
>
> On Wednesday, May 31, 2017 at 7:23:20 AM UTC+1, Daniel Harezlak wrote:
> Back to top <#m_-2436713973876021791_m_7201606050167563021_digest_top>
> Elemental2 source code on github
> 
> Daniel Harezlak : May 30 11:04PM -0700
>
> Hi, it looks like issues are disabled for the
> https://github.com/google/elemental2 project.
>
> On Saturday, May 20, 2017 at 12:34:09 AM UTC+2, Julien Dramaix wrote:
>
> Julien Dramaix : May 31 06:40AM
>
> I've enabled the issue tab.
>
> On Tue, May 30, 2017 at 11:04 PM Daniel Harezlak 
> wrote:
>
> Back to top <#m_-2436713973876021791_m_7201606050167563021_digest_top>
> You received this digest because you're subscribed to updates for this
> group. You can change your settings on the group membership page
> 
> .
> To unsubscribe from this group and stop receiving emails from it send an
> email to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CANjaDnccS5cs-ee6dkJyLzRz312sJcB2Bky2DN-YhSJXLZzikg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] Re: Elemental2 1.0.0-beta-1 and casting behaves unexpectedly

2017-05-31 Thread Daniel Harezlak
Js.cast() also throws but Js.uncheckedCast() does not. Can anyone elaborate?

On Wednesday, May 31, 2017 at 12:06:08 PM UTC+2, gwtt...@gmail.com wrote:
>
> How about using jsinterop.base.Js.cast() for the casing instead? - see: 
> https://groups.google.com/forum/#!topic/Google-Web-Toolkit/0XGv7EhDFmc
>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/338b5542-7cd3-4bd9-82fe-599f0a908200%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] Re: Elemental2 1.0.0-beta-1 and casting behaves unexpectedly

2017-05-31 Thread Daniel Harezlak
OK, this this particular use case was explained here: 
https://groups.google.com/forum/#!topic/google-web-toolkit-contributors/8lESs0WMHDM.
 
Thank you Arnaud.

On Wednesday, May 31, 2017 at 7:21:38 PM UTC+2, Daniel Harezlak wrote:
>
> Js.cast() also throws but Js.uncheckedCast() does not. Can anyone 
> elaborate?
>
> On Wednesday, May 31, 2017 at 12:06:08 PM UTC+2, gwtt...@gmail.com wrote:
>>
>> How about using jsinterop.base.Js.cast() for the casing instead? - see: 
>> https://groups.google.com/forum/#!topic/Google-Web-Toolkit/0XGv7EhDFmc
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/3df7dc4d-9e98-43d3-b40f-e8221b0f6b25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gwt-contrib] Digest for google-web-tool...@googlegroups.com - 5 updates in 2 topics

2017-05-31 Thread Daniel Harezlak
OK, it looks like the frame boundaries can be crossed in Firefox which 
yields reality check : true whereas Chrome produces reality check : false. 
Thanks for the explanation. Beside the JSNI workaround one can also use 
jsinterop.base.Js.uncheckedCast() for such cases.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/40956a25-e702-4e12-8d6f-849085d0cba9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] Using GWT libraries from J2CL

2017-05-31 Thread Anders Forsell
Hello,

>From the small examples of J2CL examples I have seen, the Java classes have 
been annotated with @JsType.
I understand that all Java code will be transpiled to ES6 JS classes with 
J2CL but can you refer/use other Java classes/libraries without adding 
specific annotations?

More concretely, if I have a GWT/Java library will I be able to use that 
library with J2CL without modifying the source of it? 

Thanks,

Anders

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/3193454b-b4c7-428b-8a19-3e730601868f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gwt-contrib] Using GWT libraries from J2CL

2017-05-31 Thread 'Goktug Gokdogan' via GWT Contributors
J2CL doesn't require @JsType; JsType serves same purpose as in GWT.

The likely steps required to make GWT library work with J2CL
(future-proofing) already described in multiple talks earlier but briefly;
no JSNI/JSO, no GWT.create, no generators and no com.google.gwt.*
references. This applies recursively to the library's deps as well.

On Wed, May 31, 2017 at 1:29 PM, Anders Forsell 
wrote:

> Hello,
>
> From the small examples of J2CL examples I have seen, the Java classes
> have been annotated with @JsType.
> I understand that all Java code will be transpiled to ES6 JS classes with
> J2CL but can you refer/use other Java classes/libraries without adding
> specific annotations?
>
> More concretely, if I have a GWT/Java library will I be able to use that
> library with J2CL without modifying the source of it?
>
> Thanks,
>
> Anders
>
> --
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-web-toolkit-contributors/3193454b-b4c7-
> 428b-8a19-3e730601868f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA1H7mpxJB-u%2B6BNyD_NEjVZArrOak7PX_E_kkzb-70j8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gwt-contrib] Using GWT libraries from J2CL

2017-05-31 Thread Anders Forsell
Ok, that sounds great!

On Wednesday, May 31, 2017 at 10:43:23 PM UTC+2, Goktug Gokdogan wrote:
>
> J2CL doesn't require @JsType; JsType serves same purpose as in GWT.
>
> The likely steps required to make GWT library work with J2CL 
> (future-proofing) already described in multiple talks earlier but briefly; 
> no JSNI/JSO, no GWT.create, no generators and no com.google.gwt.* 
> references. This applies recursively to the library's deps as well.
>
> On Wed, May 31, 2017 at 1:29 PM, Anders Forsell  > wrote:
>
>> Hello,
>>
>> From the small examples of J2CL examples I have seen, the Java classes 
>> have been annotated with @JsType.
>> I understand that all Java code will be transpiled to ES6 JS classes with 
>> J2CL but can you refer/use other Java classes/libraries without adding 
>> specific annotations?
>>
>> More concretely, if I have a GWT/Java library will I be able to use that 
>> library with J2CL without modifying the source of it? 
>>
>> Thanks,
>>
>> Anders
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "GWT Contributors" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to google-web-toolkit-contributors+unsubscr...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-web-toolkit-contributors/3193454b-b4c7-428b-8a19-3e730601868f%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/a789e18d-71b6-47cf-a8c3-15dce84d8339%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.