Re: GWT 2.9.0 release

2020-07-11 Thread Ming-Yee Iu


On Friday, 22 May 2020 22:11:15 UTC-4, Colin Alworth wrote:
>
> The really ugly way that Thomas was alluding to is moving JS to an 
> external JS file, but this is not the path of least resistance, it may be 
> brittle (unless you take great care to use JsInterop annotations to avoid 
> renames, changes in the compiler could break how you reference Java), and 
> it will not be GWT2 compatible any longer. Using JsInterop as the examples 
> above show should be simpler, more correct, and let you finish most of your 
> migration before you even glance at J2CL.
>
>
It might be nice if a future GWT 2.9.x release provides some rudimentary 
support for that procedure in preparation for J2CL. I'm not sure how that 
would look though. Maybe a way to specify extra .js files to be linked-in 
in the .gwt.xml file? Maybe a way to specify where the contents of those 
JavaScript files should be placed in the JavaScript namespace? Maybe a new 
GWT linker that outputs a single script file that runs in the same scope as 
the web page so that it doesn't require that $wnd stuff? Right now, I'm not 
sure how well blending external .js files with GWT2 actually works.

-- 
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/811d83b2-e46a-402c-9ffa-fe9cc5dd6b63o%40googlegroups.com.


DOMjnate: an Alternative to Elemental 2

2019-02-04 Thread Ming-Yee Iu
I started working on an alternative to the Elemental 2 APIs called 
DOMjnate. Like Elemental 2, DOMjnate gives you a typed interface for 
accessing the JavaScript DOM APIs. The main difference, though, is that you 
can use it in Java without using GWT or J2CL. You can make a JavaFX app 
with a webview and use the DOMjnate APIs to control the webview. Compile 
and debug your HTML5 program straight from your Java IDE without needing to 
compile to JavaScript first! You can, of course, still compile your code to 
JavaScript with GWT if you want since DOMjnate uses JsInterop.

The code is here:

https://github.com/my2iu/Domjnate

It's generated from the Typescript APIs, so it's reasonably complete. I've 
only used it for small toy programs so far, so there is probably lots of 
potential for improvement. But I did port Elemental 1 to work with the 
JavaFX webview in the past, so I'm fairly comfortable with how the plumbing 
should work.

-- 
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: GWT and Cordova/PhoneGap - use JsInterop?

2018-03-03 Thread Ming-Yee Iu
Oh, one other thing. Safari isn't very good at debugging GWT code. I don't 
think it lets you use breakpoints for code in an iframe or something, which 
is what the code generated by GWT does. So you'll have to debug JavaScript 
issues on Apple hardware blind (or write your own GWT linker to not use 
iframes or something).

-- 
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: GWT and Cordova/PhoneGap - use JsInterop?

2018-03-03 Thread Ming-Yee Iu
I've done GWT on top of Cordova for one app: https://www.wobastic.com/omber 
. It's certainly a quick way to get something running on mobile. Just use 
GWT to generate your web page. Copy everything into a Cordova project. 
Write a cordova configuration file. Run some Cordova commands, and then 
everything seems to run. I just used a combination of JSNI and JSInterop to 
hook into Cordova and its plugins when I needed to.

Things sort of fall apart once you need to start doing things that don't 
normally run in a browser or when you want to properly handle all the weird 
cellphone things like pause and resume. In those cases, the documentation 
becomes a little difficult to understand. And the abstractions that try to 
hide the difference between iOS and Android don't really work, so you end 
up having to read two or three separate documents about what the API is, 
another on how the API works on Android, yet another on how the API works 
on iOS, and then the actual Android and iOS documentation because none of 
that made sense. And Cordova seems to have pushed a lot of the non-browser, 
platform-specific stuff into community-supplied plugins. But the plugins 
are like StackOverflow, a wild west of random code of varying quality 
written by random people. There might be GWT plugins for that stuff, but I 
don't think so. I imagine there are enterprise offerings of Cordova that 
offer properly supported plugins, but I never bothered digging into there.

I did that for two years, but I recently got fed up and just wrote my own 
code for embedding a webview in a mobile app. It turns out Cordova doesn't 
actually do much. If you've got a month to spare, if you don't think very 
highly of JavaScript programmers, and if you've got the patience to write a 
lot of annoying glue code, then rolling your own is definitely the way to 
go. No poorly documented, slightly buggy plugins. You just call out to your 
own Android/iOS code, then cut & paste some sample code directly from the 
Android/iOS documentation with what you need to do, and then return the 
result. 

You do end up needing to have separate variations of your GWT app for web, 
Android, and iOS, but you would need to do that anyway with Cordova because 
the Cordova abstractions are sort of leaky.

Mind you, I also hate using JavaScript frameworks (other than GWT), and 
just use vanilla.js for everything, so keep that in mind before taking my 
advice.

-- 
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.


Where to get the latest GWT Snapshots?

2017-03-27 Thread Ming-Yee Iu
I've lately been hitting a lot of GWT compilation errors in SuperDevMode 
where GWT compiles things fine, but the outputted code is incorrect. GWT's 
name mangling ends up being mismatched where a method will be compiled to 
something like "filter_0_g$.test_22_g$" but elsewhere, code will try to 
call the method using "filter_0_g$.test_23_g$" or something like that.

Anyway, after looking through the issue tracker, I think this might be 
fixed already, so I want to download some of the latest GWT snapshots to 
see. Where can I get download a more recent nightly build of GWT?

I tried going to
   https://oss.sonatype.org/content/repositories/google-snapshots

But the jars there seemed to be missing the jsinterop.annotations package, 
so I'm not sure if that is the correct place to go or if jsinterop has 
changed or whatever.

-- 
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: GWT JsInterop to Java Rhino ?

2016-12-12 Thread Ming-Yee Iu
At one point, I temporarily lost my sanity and adapted the old Elemental to 
do something like that. Here is some test code that hooks in to JavaFx to 
run some things in Java's embedded WebKit browser:

https://github.com/my2iu/gwt/blob/elementalfx/elemental/tests/elemental/javafx/dom/FxDocumentTest.java

I imagine that when the new Elemental with JsInterop-support comes out, it 
will be adaptable in a similar way. It might even be possible now to just 
do something using Java Proxy objects and skip Elemental entirely.

Overall though, it was really ungainly. I built a whole application on top 
of it, and it was just so many types of awful. Looking back, that was not 
an avenue worth exploring.

As for unit tests, you can just use a mocking framework to mock up your 
JsInterop interfaces. Then you'd get to work entirely in Java while still 
testing your code properly.

-- 
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: GWT 2.8 next release

2016-04-08 Thread Ming-Yee Iu
Is there an ETA on RC1? How long is it expected to take to take to emulate 
all those Java 8 APIs? Couldn't API emulation be put off until a 2.8.1 or 
something?

-- 
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: Getting rid of Dev mode for future GWT releases

2015-12-30 Thread Ming-Yee Iu
I don't think it's technically impossible to keep DevMode running. I was 
able to get DevMode to work using JavaFx as the browser instead of Chrome, 
and it seemed to work ok for basic stuff. It might also be possible to port 
the GWT UI framework to Elemental, and I've also been able to get Elemental 
to run in Java on top of JavaFx. I suppose it's even possible to make 
special versions of Firefox or Chrome that have the features needed to 
support the DevMode plugin directly.

I doubt that Google sees any value in maintaining DevMode for itself 
though. But I imagine if you have a support contract with an enterprise 
software firm selling GWT stuff like Vaadin or RedHat, you could probably 
bug them to do the necessary work to make it happen.

-- 
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: JSInterop sample / tutorial?

2015-11-28 Thread Ming-Yee Iu
Is the @JsFunction stuff idempotent? (I'm not sure what the correct term to 
use is.)

The main thing is, does this work?

   @JsFunction Function { ... }

   Function listener = (evt) => { evt.preventDefault(); };

   doc.addEventListener("click", listener);

then later on

   doc.removeEventListener("click", listener);

It looks like it should be fine, but I just want to make sure.

Also, I sometimes had problems with the old JSNI stuff when using optional 
parameters in JS. I'm not sure why, but sometimes GWT would complain. Does 
that work ok in JsInterop?

   doc.addEventListener("click", listener);
vs.
   doc.addEventListener("click", listener, false);

I know with GWT Elemental, it would always complain about the first case.

-Ming



On Tuesday, 24 November 2015 09:47:20 UTC-5, Jens wrote:
>
>
> Any updates about the starting guide of JSInterop?
>>
>
> Everything you need to know for GWT 2.8 JsInterop: 
> https://docs.google.com/document/d/10fmlEYIHcyead_4R1S5wKGs1t2I7Fnp_PaNaa7XTEk0/edit
>
> -- 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Where is GWT Elemental?

2015-06-12 Thread Ming-Yee Iu
That's the one I watched. After rooting around the GWT Elemental code over 
the past week, I think that there is no Elemental 2.0 at the moment (or, at 
least, there's no public Elemental 2.0 at the moment). None of the 
Elemental code I saw used JsInterop, Elemental still used a lot of stuff 
borrowed from Dart to generate its code, its code is generated from WebKit 
interface definitions, and it doesn't seem like anyone is really working on 
Elemental at the moment (it still has the same bugs and annoyances that 
have been there for years). As far as I can tell, Elemental 2.0 and 
JsInterop are more in the "future plans" category.




On Friday, 5 June 2015 23:12:21 UTC-4, Thad Humphries wrote:
>
> You mean this video?  *GWT.create 2015 - Deep dive in JS Interop (Ray 
> Cromwell) <https://www.youtube.com/watch?v=-s4Wfnojh1Q>*
>
> If not, which one? I have the Polymer bug.
>
> On Friday, June 5, 2015 at 3:03:23 PM UTC-4, Ming-Yee Iu wrote:
>>
>> Never mind. I watched the JsInterop video and caught up.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


ElementalFx: GWT Elemental for the Desktop

2015-06-12 Thread Ming-Yee Iu
I finished porting GWT Elemental to JavaFx's WebView. I call it 
ElementalFx. The code is sitting in the "elementalfx" branch of my clone of 
the GWT git repository:

  https://github.com/my2iu/gwt

With ElementalFx, you can use GWT Elemental to make desktop apps. You can 
use the same UI code for both the desktop and for the web. It can be 
helpful in use cases like

1) You need to write a web-version and a PC/Mac/Linux-version of an app, 
and you don't want to write the UI code twice
2) You want to write a UI widget and share it between a HTML5 web page and 
a desktop application
3) You have an existing Swing or SWT application, and you want to migrate 
it to HTML5 by gradually replacing components and dialogs with HTML5 
versions
4) You need to write a desktop application, but you don't want to waste 
your time learning a niche desktop UI framework when you could just use 
HTML5 for everything
5) You have some legacy Java UI programmers, and you want to upgrade their 
skills to include HTML5 in a gradual manner
6) You want to debug and test a GWT Elemental application without using 
SuperDevMode or DevMode

In the future, I would like to port Elemental to Android and iOS too, then 
you could reuse your UI code across web, mobile, and desktop. I don't have 
the cycles to take that on in the near future though. My initial look at 
the Android WebView suggested that it didn't export the right interface 
needed to support something like Elemental, so doing the port would involve 
creating a custom WebView that can be embedded in apps, which is a lot of 
work.

Just thought some of you might be interested,
Ming

p.s. As a demonstration of it working, I took a game I wrote for a game jam 
in Elemental and adapted it to run in ElementalFx. Here's a screenshot of 
it running in Linux:

  http://www.jinq.org/elementalfx-screen.png

The game uses 2 Canvas elements, several DIVs that are updated using 
innerHTML, JSON processing, a timer, and keyboard events.

In order to get things to work, I had to do these things:

1) Using XMLHttpRequest would cause the JVM to crash (I think it's a bug in 
JavaFx). Since this was now a desktop Java program, it was fairly easy just 
to replace that code with something that used real Java instead

2) All my sound effects using HTML5 Audio caused 
IllegalThreadStateException errors. I imagine JavaFx probably doesn't 
properly support audio in its WebView or something.

3) The original code used Browser.getWindow() and Browser.getDocument() a 
lot to get at the window and document objects. This doesn't make sense in 
ElementalFx because the Java code does not run in the context of a web 
page. In fact, a desktop Java application can have multiple WebViews with 
multiple windows and documents. I had to change my code to pass in the 
window/document to use when doing UI stuff

4) I had to remove the script tag that would run the compiled GWT JS code 
from the HTML. Instead, my Java code would just run itself after it had 
loaded the HTML.

5) I needed to write my own bootstrap code to start the application. Here 
is what it looks like:

@GwtIncompatible
public class FxMain extends Application
{
  public static void main(String[] args) 
  {
launch(args);
  }

  @Override
  public void start(Stage stage) throws Exception {
// Create the WebView
VBox region = new VBox();
WebView webView = new WebView();
final WebEngine engine = webView.getEngine();
region.getChildren().add(webView);

Scene scene = new Scene(region);
stage.setScene(scene);
stage.show();

// Redirect the alert handler to send output to stderr
engine.setOnAlert(new EventHandler>() {
  @Override
  public void handle(WebEvent msg) {
System.err.println(msg.getData());
  }});

// Start up the Gwt module when the page has finished loading. Grab the 
window
// and document objects and stash them somewhere for use later.
engine.getLoadWorker().stateProperty().addListener(
new ChangeListener() {
  @Override
  public void changed(ObservableValue ov,
  State oldState, State newState) {
if (newState == Worker.State.SUCCEEDED) {
  Module.win = 
(Window)GwtFxBridge.wrapJs(engine.executeScript("window"));
  Module.doc = Module.win.getDocument();
  new Module().onModuleLoad();
}
  }
});

// Load the main Gwt application web page
engine.load(new File("index.html").toURI().toURL().toExternalForm());
  }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Re: Where is GWT Elemental?

2015-06-05 Thread Ming-Yee Iu
Never mind. I watched the JsInterop video and caught up.


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Where is GWT Elemental?

2015-06-05 Thread Ming-Yee Iu
Now I'm confused again. 

I've read about some sort of GWT Elemental 2.0 that's being developed 
somewhere.

What's the difference between

1) the code in the elemental directory in GWT's git repository (isn't this 
supposed to be GWT 2.8?)
2) Elemental 2.0
3) JsInterop + GWT 2.8




On Tuesday, 2 June 2015 06:39:15 UTC-4, Jens wrote:
>
> Yes its just the stuff in the elemental directory when you checkout the 
> gwt project. When you run "ant elemental" the remaining stuff will be 
> generated and packed into the gwt-elemental.jar.
>
> You might want to consider using JsInterop + GWT 2.8 instead of elemental.
>
> -- J.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Where is GWT Elemental?

2015-06-01 Thread Ming-Yee Iu
Where is the code for building GWT's Elemental library?

Is it just the stuff in the "elemental" directory? I vaguely remember 
someone saying that the latest development work on Elemental is actually 
taking place in a separate project from the main GWT project. Is that true?

I want to build a Java desktop UI framework based on Elemental, and I want 
to make sure I'm working with the latest code before I start.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Rescue DevMode via JavaFx and JavaPlugin?

2015-06-01 Thread Ming-Yee Iu
I have no idea. I find the GWT roadmap to be a little opaque, and 
everything always arrives a couple of years after when it's promised to 
arrive, so I usually don't pay attention to what's in development until it 
actually gets released.

In any case, there's still a bunch of enterprise people doing GWT stuff. 
Even though Google has no interest in supporting legacy GWT stuff, I 
imagine there are firms that are willing to do support for those enterprise 
people, and I thought maybe they would be interested since it's not a lot 
of code.

I'm actually planning on going in a different direction (the plugin works 
differently than how I expected it to), so I have no use for a WebKit 
DevMode plugin that runs in Java, so I was just throwing it out there in 
case anyone was interested in dabbling in it further.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Rescue DevMode via JavaFx and JavaPlugin?

2015-05-30 Thread Ming-Yee Iu
Actually, I've been curious about this for a long time too. I finally set 
aside some time to try it out, and it seems like it might be a viable 
approach (at least, I was able to get the Hello example running).

I was able to get a "gwt plugin" working in the JavaFx WebView with < 500 
lines of code. A lot of the necessary code already exists as part of the 
GWT unit tests, so I was able to just take a peek at how things worked over 
there and do a similar thing with JavaFx. There's one thing that the GWT 
plugin seems to do that I don't think is possible with JavaFx, which is it 
allows JavaScript to treat Java objects like arrays. I'm not sure if that 
feature is actually used anywhere, so it might not be a problem. There's 
also a potential issue with the fact that the JavaFx WebView uses ancient 
LiveScript conventions from the Netscape days for interfacing Java with 
JavaScript. So it's not possible to differentiate between undefined values 
and the string "undefined," for example. Also, it looked like JavaFx might 
crash if a Java exception propagates through to the JavaScript side, but I 
didn't bother to really dig into that to see what was going on.

Doing a cursory search, I actually wasn't able to find anything in the 
plugin for letting the JavaScript engine send GC information back to the 
server. I think the GWT UI framework was designed so that there won't 
really be pointers from the JS side to the Java side, so the Java side can 
be in charge of all the memory management (in fact, the Java side does tell 
the JS side when to delete JS objects). I didn't dig too deeply though. I 
just implemented enough to get the Hello example working.

If you're interested, I can try cleaning up the code and checking it in 
somewhere.

-Ming

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.