Re: elemental.json confusion/error

2017-09-20 Thread Thomas Broyer


On Wednesday, September 20, 2017 at 12:49:21 PM UTC+2, 
max.d...@corussoft.de wrote:
>
> Hi there
>
> I recently started using elemental.json. But I recently stumbled upon 
> strange (expected?) behaviour. Is there any good documentation? The javadoc 
> is quiet lacking, at least in this regard. So, what am I confused about?
>

My first and main advice would be: don't use Elemental.
If you need to parse JSON with a known structure, use JsInterop to describe 
that structure (as @JsType(isNative=true, namespace=JsPackage.GLOBAL, 
name="*"), or name="Object" if you can't use name="*"), and then either 
com.google.gwt.core.client.JsonUtils.safeEval() with a 
cast to your JsInterop interface/class, or JsInterop to call JSON.parse() 
(as @JsMethod(namespace="JSON", name="parse") static native  T 
parseJson(String json)).
If you don't know the structure upfront, then use jsinterop-base's types 
instead https://javadoc.io/doc/com.google.jsinterop/base/1.0.0-beta-2 
(JsPropertyMap mostly, and the Js helper class), and the same method for 
parsing. You might also want to have a look at 
elemental2-core: 
https://javadoc.io/doc/com.google.elemental2/elemental2-core/1.0.0-beta-1 
(which BTW defines JSONType.parse(…)), but be careful as Elemental2 is 
entirely generated, and might change in the future as the generator evolves 
(also, Elemental 2 might require that you use the HEAD-SNAPSHOT of GWT)

If you need something that can be used in a JVM too, you might be able to 
use GSON or Jackson to parse into similar structures (possibly define a 
JsPropertyMap implementation that wraps a LinkedHashMap).

 

> First, there is a "getNumber" (and it's equivalents), but those fail with 
> a classcastexception, if you use it on parsed Json. There is no problem if 
> you use it on values that were "put" there. Is that working as intended? 
> Second, and I guess this is a bug: If you use get(key).asBoolean() on a 
> recently parsed value, you get the correct value. But if you use it on a 
> value "false" you "put" in, you get true. 
>
> I would be happy if someone could shine some light on this for me :)
>

These are likely bugs, and they're unlikely to ever be fixed (unless maybe 
someone provides the patch).

I wrote a small "test" to demonstrate it:
>
> import com.google.gwt.core.shared.GWT;
>
> import elemental.json.JsonObject;
> import elemental.json.impl.JsonUtil;
>

The correct way is Json.instance(), one shouldn't ever use any "impl" class.

-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Problem compiling GWT code with Java9

2017-09-20 Thread Pratik Parikh
Thank you. 



On Wednesday, September 20, 2017 at 4:06:51 AM UTC-4, Thomas Broyer wrote:
>
> There have been some changes [1,2] to make it (at least partially) work 
> with a Java 9 VM; you can try HEAD-SNAPSHOT (from 
> https://oss.sonatype.org/content/repositories/google-snapshots/) until we 
> release 2.8.2 with the changes.
>
> [1] 
> https://github.com/gwtproject/gwt/commit/87f27659af55d7d549521405ef10889e8dfe3f3a
> [2] 
> https://github.com/gwtproject/gwt/commit/5b7560c4bb6376e997981387e4f2feee1816e1dc
>
> On Wednesday, September 20, 2017 at 9:49:20 AM UTC+2, Pratik Parikh wrote:
>>
>> does anyone have an update on this sissu?  I am running into the same 
>> problem, so an update would help.
>>
>> On Tuesday, June 13, 2017 at 12:08:29 PM UTC-4, James Nelson wrote:
>>>
>>> Hi.
>>>
>>> I am currently very busy this week, but can try to schedule a push to 
>>> maven central this weekend (I have other people waiting on it to use 
>>> various other tools I dabble in as well).
>>>
>>> Please remind me if I don't post links back here by next Monday.
>>>
>>> Worst case scenario, I can just upload jars to github and push a gist of 
>>> the pom I used, with some instructions on how to set the system properties 
>>> to make it work.
>>>
>>> I used the IDE to handle vm args, as standard maven plugins are less 
>>> amenable to hacking / debugging (though I'm sure it must be possible, I did 
>>> not have enough free time to get that far on it).
>>>
>>> I'll probably update to latest java 9 spec, since the module system has 
>>> undergone another iteration since I tried these hacks.
>>>
>>> Please keep in mind, however, that my fork has diverged from mainline 
>>> for quite a while, and does not undergo the same rigorous testing that you 
>>> might expect.
>>> In particular, if you start using any of the other features I've added 
>>> (reflection, arbitrary magic method injection), it can break incremental 
>>> recompilations.
>>> It's a known issue I'm avoiding looking at, since most of the 2.X stack 
>>> is going to go away, and I have to migrate all my magic into apt-generators 
>>> to run as a pre-gwtc stage.
>>>
>>> While I might be able to help you get something that works as a proof of 
>>> concept, I would urge you to hold off on using it in production, as I am 
>>> not (yet) ready to offer fulltime support.
>>> A couple colleagues and I are playing with the idea of offering fulltime 
>>> support and maintenance of 2.X around mid-September (barring a funding 
>>> miracle for our current money-source).
>>>
>>> So, please take this caveats to heart; I can probably get you up and 
>>> compiling, but this should all be viewed as experimental and not-production 
>>> ready for a while yet.
>>>
>>

-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: How to embed an external page in GWT application?

2017-09-20 Thread Rodolfo M. Raya
Add an HTML panel to your app and populate the panel with the page that you
want to embed.


On Wed, Sep 20, 2017 at 4:49 AM  wrote:

> Is there a solution to this problem??
>
> On Wednesday, January 27, 2010 at 12:31:32 PM UTC-6, kelvin.huang wrote:
>>
>> Thanks Stevko!
>>
> --
> 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 post to this group, send email to google-web-toolkit@googlegroups.com.
> Visit this group at https://groups.google.com/group/google-web-toolkit.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


elemental.json confusion/error

2017-09-20 Thread max.dubiel via GWT Users
Hi there

I recently started using elemental.json. But I recently stumbled upon 
strange (expected?) behaviour. Is there any good documentation? The javadoc 
is quiet lacking, at least in this regard. So, what am I confused about?

First, there is a "getNumber" (and it's equivalents), but those fail with a 
classcastexception, if you use it on parsed Json. There is no problem if 
you use it on values that were "put" there. Is that working as intended? 
Second, and I guess this is a bug: If you use get(key).asBoolean() on a 
recently parsed value, you get the correct value. But if you use it on a 
value "false" you "put" in, you get true. 

I would be happy if someone could shine some light on this for me :)

I wrote a small "test" to demonstrate it:

import com.google.gwt.core.shared.GWT;

import elemental.json.JsonObject;
import elemental.json.impl.JsonUtil;


public class ElementalJsonConfusion {
public static void testBoolean() {
String json = "{\"booleanValue\":false}";

JsonObject jsonValue = (JsonObject) JsonUtil.parse(json);
// output false
GWT.log("First asBoolean: " + jsonValue.get("booleanValue").asBoolean());

jsonValue.put("booleanValue", false);
// output true
GWT.log("Second asBoolean: " + jsonValue.get("booleanValue").asBoolean());

jsonValue = (JsonObject) JsonUtil.parse(json);
// output Exception
try {
GWT.log("First getBoolean: " + jsonValue.getBoolean("booleanValue"));
} catch (ClassCastException e) {
GWT.log("First getBoolean ClassCastException");
}
jsonValue.put("booleanValue", false);
// Output false
GWT.log("Second getBoolean: " + jsonValue.getBoolean("booleanValue"));
}



public static void testNumber() {
String json = "{\"numberValue\":123}";

JsonObject jsonValue = (JsonObject) JsonUtil.parse(json);

jsonValue = (JsonObject) JsonUtil.parse(json);
// output Exception
try {
GWT.log("First getNumber: " + jsonValue.getNumber("numberValue"));
} catch (ClassCastException e) {
GWT.log("First getNumber ClassCastException");
}
jsonValue.put("numberValue", 123);
// Output 123
GWT.log("Second getNumber: " + jsonValue.getNumber("numberValue"));
}
}


-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: SuperDevMode recompiles RPC since they are unchanged

2017-09-20 Thread Thomas Broyer


On Wednesday, September 20, 2017 at 11:25:45 AM UTC+2, Ignacio Baca 
Moreno-Torres wrote:
>
> Eh! the bookmark (or similar tool 
> https://gist.github.com/ibaca/1dc87a58ee542840a5f90c5ff2931329) are still 
> useful if you use only the codeserver.
>

If you mean "only the codeserver", without an HTTP server for the HTML host 
page, then yes; but that's really an edge-case (and the only valid use case 
for the embedded Jetty in DevMode if you ask me)
That's what I call a "standalone app" 
in https://tbroyer.github.io/gwt-maven-plugin/codeserver.html

I'd still strongly recommend using either DevMode or a separate HTTP server 
("python -m http.server" works great; but there are many other similar 
lightweight tools; or possibly https://github.com/tbroyer/gwt-devserver) 
and *not* rely on the bookmarklets.

We're getting really off topic for the thread though.

-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: SuperDevMode recompiles RPC since they are unchanged

2017-09-20 Thread Ignacio Baca Moreno-Torres
Eh! the bookmark (or similar tool
https://gist.github.com/ibaca/1dc87a58ee542840a5f90c5ff2931329) are still
useful if you use only the codeserver.

On mié., 20 sept. 2017 10:51 Jens  wrote:

>
> Hey Jens, nobody should use the bookmarklets in 2.7 either ;-)
>>
>
> Oh indeed, mmmh I guess mixing it up was a symptom of always using some
> custom build of GWT :-)
>
> -- 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 post to this group, send email to google-web-toolkit@googlegroups.com.
> Visit this group at https://groups.google.com/group/google-web-toolkit.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: SuperDevMode recompiles RPC since they are unchanged

2017-09-20 Thread Jens


> Hey Jens, nobody should use the bookmarklets in 2.7 either ;-)
>

Oh indeed, mmmh I guess mixing it up was a symptom of always using some 
custom build of GWT :-)

-- 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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Problem compiling GWT code with Java9

2017-09-20 Thread Thomas Broyer
There have been some changes [1,2] to make it (at least partially) work 
with a Java 9 VM; you can try HEAD-SNAPSHOT 
(from https://oss.sonatype.org/content/repositories/google-snapshots/) 
until we release 2.8.2 with the changes.

[1] 
https://github.com/gwtproject/gwt/commit/87f27659af55d7d549521405ef10889e8dfe3f3a
[2] 
https://github.com/gwtproject/gwt/commit/5b7560c4bb6376e997981387e4f2feee1816e1dc

On Wednesday, September 20, 2017 at 9:49:20 AM UTC+2, Pratik Parikh wrote:
>
> does anyone have an update on this sissu?  I am running into the same 
> problem, so an update would help.
>
> On Tuesday, June 13, 2017 at 12:08:29 PM UTC-4, James Nelson wrote:
>>
>> Hi.
>>
>> I am currently very busy this week, but can try to schedule a push to 
>> maven central this weekend (I have other people waiting on it to use 
>> various other tools I dabble in as well).
>>
>> Please remind me if I don't post links back here by next Monday.
>>
>> Worst case scenario, I can just upload jars to github and push a gist of 
>> the pom I used, with some instructions on how to set the system properties 
>> to make it work.
>>
>> I used the IDE to handle vm args, as standard maven plugins are less 
>> amenable to hacking / debugging (though I'm sure it must be possible, I did 
>> not have enough free time to get that far on it).
>>
>> I'll probably update to latest java 9 spec, since the module system has 
>> undergone another iteration since I tried these hacks.
>>
>> Please keep in mind, however, that my fork has diverged from mainline for 
>> quite a while, and does not undergo the same rigorous testing that you 
>> might expect.
>> In particular, if you start using any of the other features I've added 
>> (reflection, arbitrary magic method injection), it can break incremental 
>> recompilations.
>> It's a known issue I'm avoiding looking at, since most of the 2.X stack 
>> is going to go away, and I have to migrate all my magic into apt-generators 
>> to run as a pre-gwtc stage.
>>
>> While I might be able to help you get something that works as a proof of 
>> concept, I would urge you to hold off on using it in production, as I am 
>> not (yet) ready to offer fulltime support.
>> A couple colleagues and I are playing with the idea of offering fulltime 
>> support and maintenance of 2.X around mid-September (barring a funding 
>> miracle for our current money-source).
>>
>> So, please take this caveats to heart; I can probably get you up and 
>> compiling, but this should all be viewed as experimental and not-production 
>> ready for a while yet.
>>
>

-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: SuperDevMode recompiles RPC since they are unchanged

2017-09-20 Thread Thomas Broyer


On Tuesday, September 19, 2017 at 5:30:11 PM UTC+2, Jens wrote:
>
> IMHO it is preferable to launch SuperDevMode and your server (be it jetty 
> or anything else) separately so you can restart them separately. We do that 
> at work and only rarely restart SuperDevMode.
>

I wholeheartedly agree, but even when using the embedded Jetty container in 
DevMode, you can restart the webapp without restarting DevMode.
 

> Generally restarting SuperDevMode in GWT 2.8.x works better as GWT 2.8.x 
> stores a cache on disk that can be reused between restarts. Also GWT 2.8.x 
> SuperDevMode only recompiles code that has been modified when you reload 
> the browser. GWT 2.7. always recompiles the whole app when using the 
> bookmarklets to recompile your code. So generally GWT 2.8.x SuperDevMode 
> should work faster in terms of recompilation.
>

Hey Jens, nobody should use the bookmarklets in 2.7 either ;-)
But yes, as I said 
in https://github.com/gwtproject/gwt/issues/9549#issuecomment-330555850, 
2.8 (or HEAD-SNAPSHOT) should work better *and* would be the basis for a 
fix/improvement if ever needed, so the first thing to do is (always) 
updating to the latest version (and trying HEAD-SNAPSHOT too if you can).

-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: How to embed an external page in GWT application?

2017-09-20 Thread hemonthjava08
Is there a solution to this problem??

On Wednesday, January 27, 2010 at 12:31:32 PM UTC-6, kelvin.huang wrote:
>
> Thanks Stevko!
>

-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Problem compiling GWT code with Java9

2017-09-20 Thread Pratik Parikh
does anyone have an update on this sissu?  I am running into the same 
problem, so an update would help.

On Tuesday, June 13, 2017 at 12:08:29 PM UTC-4, James Nelson wrote:
>
> Hi.
>
> I am currently very busy this week, but can try to schedule a push to 
> maven central this weekend (I have other people waiting on it to use 
> various other tools I dabble in as well).
>
> Please remind me if I don't post links back here by next Monday.
>
> Worst case scenario, I can just upload jars to github and push a gist of 
> the pom I used, with some instructions on how to set the system properties 
> to make it work.
>
> I used the IDE to handle vm args, as standard maven plugins are less 
> amenable to hacking / debugging (though I'm sure it must be possible, I did 
> not have enough free time to get that far on it).
>
> I'll probably update to latest java 9 spec, since the module system has 
> undergone another iteration since I tried these hacks.
>
> Please keep in mind, however, that my fork has diverged from mainline for 
> quite a while, and does not undergo the same rigorous testing that you 
> might expect.
> In particular, if you start using any of the other features I've added 
> (reflection, arbitrary magic method injection), it can break incremental 
> recompilations.
> It's a known issue I'm avoiding looking at, since most of the 2.X stack is 
> going to go away, and I have to migrate all my magic into apt-generators to 
> run as a pre-gwtc stage.
>
> While I might be able to help you get something that works as a proof of 
> concept, I would urge you to hold off on using it in production, as I am 
> not (yet) ready to offer fulltime support.
> A couple colleagues and I are playing with the idea of offering fulltime 
> support and maintenance of 2.X around mid-September (barring a funding 
> miracle for our current money-source).
>
> So, please take this caveats to heart; I can probably get you up and 
> compiling, but this should all be viewed as experimental and not-production 
> ready for a while yet.
>

-- 
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 post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.