Thursday, July 31, 2025

Re: Mixing Elemental2 with GWT Widgets

Thanks Gerard, I'll check out Elemento.

Elemental2 is a little lacking on strongly typing events.  Eg: Adding this code:

myElement.addEventListener(BrowserEvents.MOUSEDOWN, event -> {
  MouseEvent mouseEvent = Js.cast(event);
  ...
});

I could mess up on the event name, or the typecast, and I wouldn't know until runtime.

And unless you read the JS docs, it's not obvious what event name, maps to what event object.

Having something that strongly types all the events, so it was obvious and stops you messing up, would be great.

On Thursday, 31 July 2025 at 11:17:54 pm UTC+10 Gerard Keiser wrote:
Elemento has event more event types, if you need: https://hal-console.gitbook.io/elemento/event-handlers

On Thursday, July 31, 2025 at 4:45:19 AM UTC-5 Jens wrote:
btw:  With addEventListener, we have to use hard coded strings for the event name.  Eg: 

img.addEventListener("load", e -> doStuff());

Or are there event name constants we can use somewhere?

GWT has com.google.gwt.dom.client.BrowserEvents but it is not a complete list.

-- 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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/094cfcd2-209d-4537-9d69-6d7218576b53n%40googlegroups.com.

Re: Mixing Elemental2 with GWT Widgets

Elemento has event more event types, if you need: https://hal-console.gitbook.io/elemento/event-handlers

On Thursday, July 31, 2025 at 4:45:19 AM UTC-5 Jens wrote:
btw:  With addEventListener, we have to use hard coded strings for the event name.  Eg: 

img.addEventListener("load", e -> doStuff());

Or are there event name constants we can use somewhere?

GWT has com.google.gwt.dom.client.BrowserEvents but it is not a complete list.

-- 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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/e19614db-729d-43f7-aaf8-ec7668ae8df6n%40googlegroups.com.

Re: Mixing Elemental2 with GWT Widgets

Thanks for sharing!

On Thu, Jul 31, 2025 at 6:56 AM Craig Mitchell <mail@craig-mitchell.com> wrote:
My OCD has been satisfied.  🙂  Thanks again Jens.

public static void loadImage(String imgBase64, Consumer<HTMLImageElement> loaded) {
  
HTMLImageElement img = (HTMLImageElement)DomGlobal.document.createElement(ImageElement.TAG);

  img.addEventListener(BrowserEvents.LOAD, e -> loaded.accept(img));
  img.addEventListener(BrowserEvents.ERROR, e -> DomGlobal.console.error("Failed to load image."));
  img.src = imgBase64;
}

On Thursday, 31 July 2025 at 7:45:19 pm UTC+10 Jens wrote:
btw:  With addEventListener, we have to use hard coded strings for the event name.  Eg: 

img.addEventListener("load", e -> doStuff());

Or are there event name constants we can use somewhere?

GWT has com.google.gwt.dom.client.BrowserEvents but it is not a complete list.

-- 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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/261f0865-534c-49e6-afdb-5e4f60e377acn%40googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/CA%2BkiFsfPFPXypbjoTu1grVhaRxU-AFC9Bu7fPV05GC8HktaqdA%40mail.gmail.com.

Re: Mixing Elemental2 with GWT Widgets

My OCD has been satisfied.  🙂  Thanks again Jens.

public static void loadImage(String imgBase64, Consumer<HTMLImageElement> loaded) {
  
HTMLImageElement img = (HTMLImageElement)DomGlobal.document.createElement(ImageElement.TAG);

  img.addEventListener(BrowserEvents.LOAD, e -> loaded.accept(img));
  img.addEventListener(BrowserEvents.ERROR, e -> DomGlobal.console.error("Failed to load image."));
  img.src = imgBase64;
}

On Thursday, 31 July 2025 at 7:45:19 pm UTC+10 Jens wrote:
btw:  With addEventListener, we have to use hard coded strings for the event name.  Eg: 

img.addEventListener("load", e -> doStuff());

Or are there event name constants we can use somewhere?

GWT has com.google.gwt.dom.client.BrowserEvents but it is not a complete list.

-- 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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/261f0865-534c-49e6-afdb-5e4f60e377acn%40googlegroups.com.

Re: Mixing Elemental2 with GWT Widgets

btw:  With addEventListener, we have to use hard coded strings for the event name.  Eg: 

img.addEventListener("load", e -> doStuff());

Or are there event name constants we can use somewhere?

GWT has com.google.gwt.dom.client.BrowserEvents but it is not a complete list.

-- 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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/e0922888-e638-489f-a3c7-b5ac308dc6a1n%40googlegroups.com.

Re: Mixing Elemental2 with GWT Widgets

btw:  With addEventListener, we have to use hard coded strings for the event name.  Eg: 

img.addEventListener("load", e -> doStuff());

Or are there event name constants we can use somewhere?

On Thursday, 31 July 2025 at 7:29:07 pm UTC+10 Craig Mitchell wrote:
Excellent  explanations.  Makes sense.  Thanks Jens.

On Thursday, 31 July 2025 at 7:25:56 pm UTC+10 Jens wrote:
What I don't understand is why onload and onerror need a return value?  I just return null as I've no clue what the return value should be.

Because these on<Event> properties and their functions are defined that way. For example in the old days you could return false in an onclick function to suppress the click default action of the browser. These days it is recommended to always use addEventListener() instead of these event properties and to suppress the default action you call event.preventDefault().

Also in JS a function basically always have some return value, e.g.

function() {
  return;
  return undefined;
  // no return statement at all
}

is all the same and returns undefined. That is why Promises in elemental2 also feel a bit clunky compared to JS. Promises allow you to return a new Promise/thenable in your success/catch callback methods so elemental2 has to define a return type for these callback functions. If you do not want to return a Promise/thenable in JS then you simply do not write a return statement but in Java you now have to write return null.

-- 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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/db240757-819a-440d-bd31-d7518c953309n%40googlegroups.com.

Re: Mixing Elemental2 with GWT Widgets

Excellent  explanations.  Makes sense.  Thanks Jens.

On Thursday, 31 July 2025 at 7:25:56 pm UTC+10 Jens wrote:
What I don't understand is why onload and onerror need a return value?  I just return null as I've no clue what the return value should be.

Because these on<Event> properties and their functions are defined that way. For example in the old days you could return false in an onclick function to suppress the click default action of the browser. These days it is recommended to always use addEventListener() instead of these event properties and to suppress the default action you call event.preventDefault().

Also in JS a function basically always have some return value, e.g.

function() {
  return;
  return undefined;
  // no return statement at all
}

is all the same and returns undefined. That is why Promises in elemental2 also feel a bit clunky compared to JS. Promises allow you to return a new Promise/thenable in your success/catch callback methods so elemental2 has to define a return type for these callback functions. If you do not want to return a Promise/thenable in JS then you simply do not write a return statement but in Java you now have to write return null.

-- 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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/5637485f-905b-488f-b8ab-68ea568a1d8bn%40googlegroups.com.

Re: Mixing Elemental2 with GWT Widgets

What I don't understand is why onload and onerror need a return value?  I just return null as I've no clue what the return value should be.

Because these on<Event> properties and their functions are defined that way. For example in the old days you could return false in an onclick function to suppress the click default action of the browser. These days it is recommended to always use addEventListener() instead of these event properties and to suppress the default action you call event.preventDefault().

Also in JS a function basically always have some return value, e.g.

function() {
  return;
  return undefined;
  // no return statement at all
}

is all the same and returns undefined. That is why Promises in elemental2 also feel a bit clunky compared to JS. Promises allow you to return a new Promise/thenable in your success/catch callback methods so elemental2 has to define a return type for these callback functions. If you do not want to return a Promise/thenable in JS then you simply do not write a return statement but in Java you now have to write return null.

-- 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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/4a755a9a-a509-4003-b0af-82c8f4a385edn%40googlegroups.com.

Re: Mixing Elemental2 with GWT Widgets

That is usually what you would do. That is how GWT itself implements widgets and it does not really matter if you use an elemental2 element or a GWT element since both link directly to the underlying js type in the browser and thus you can cross cast them.

So instead of just having an adapter widget you could also implement your own widgets using elemental2 element as a basis. Imagine you would rename your Elemental2Widget to Artboard or SceneCanvas and then you could implement all the methods you need on that widget similar to what GWT does with its own widgets.

What you cannot do is elemental2Element.append(gwtWidget.getElement()). In that case events on the GWT widget will not work because GWT widgets have their own event mechanism which requires a continuous widget parent/child relation up to the root panel (or some hackery to make it work).

-- J.

Craig Mitchell schrieb am Mittwoch, 30. Juli 2025 um 06:34:49 UTC+2:
I've switched to use Elemental2 for a few things.  The rest of my app still uses the standard GWT widgets.

I can bind directly to the Elemental2 elements from the GWT UI Binder, however, if I programatically want to add an Elemental2 element to a GWT Widget, there doesn't seem to be a direct way to do this.

Eg: How would you add the Elemental2 HTMLCanvasElement, to a GWT SimplePanel using its setWidget method?

To work around this, I created an "Elemental2Widget":

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
import jsinterop.base.Js;

public class Elemental2Widget<T> extends Widget {
  public Elemental2Widget(T elemental2Widget) {
    Element element = Js.cast(elemental2Widget);
    setElement(element);
  }
  public T getElemental2Widget() {
    return Js.cast(getElement());
  }
}

Now I can call it like this:

simplePanel.setWidget(new Elemental2Widget<>(htmlCanvasElement));

Is this how people mix Elemental2 with GWT widgets?  Or is there a better way?

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/17b81a23-fc5b-4577-a72e-3c9105ca8c8fn%40googlegroups.com.

Re: Mixing Elemental2 with GWT Widgets

Excellent!  Will be good to have some company on the Elemental2 journey.  🙂

While I'm sharing...  I wrote a method to load an HTMLImageElement from a base64 encoded string:

public static void loadImage(String imgBase64, Consumer<HTMLImageElement> loaded) {
  HTMLImageElement img = (HTMLImageElement)DomGlobal.document.createElement("img");

  img.onload = e -> {
    loaded.accept(img);
    return null;
  };

  img.onerror = e -> {
    DomGlobal.console.error("Failed to load image.");
    return null;
  };

  img.src = imgBase64;
}

What I don't understand is why onload and onerror need a return value?  I just return null as I've no clue what the return value should be.

On Thursday, 31 July 2025 at 4:20:40 pm UTC+10 Ralph Fiergolla wrote:
Craig! 
Don't worry - i am following your Elemtal2 Experience closely. It is on my to-do list for quite some time now. Thanks for sharing! 
Ralph 

Craig Mitchell <ma...@craig-mitchell.com> schrieb am Do. 31. Juli 2025 um 02:37:
On the off chance someone reads the above post and thinks Elemental2 isn't very good.  Just to make it clear, Elemental2 is awesome.  Just now I needed a WeakHashMap.  GWT said no.  Elemental2 said sure can, with JsWeakMap.  Love it!

On Wednesday, 30 July 2025 at 2:34:49 pm UTC+10 Craig Mitchell wrote:
I've switched to use Elemental2 for a few things.  The rest of my app still uses the standard GWT widgets.

I can bind directly to the Elemental2 elements from the GWT UI Binder, however, if I programatically want to add an Elemental2 element to a GWT Widget, there doesn't seem to be a direct way to do this.

Eg: How would you add the Elemental2 HTMLCanvasElement, to a GWT SimplePanel using its setWidget method?

To work around this, I created an "Elemental2Widget":

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
import jsinterop.base.Js;

public class Elemental2Widget<T> extends Widget {
  public Elemental2Widget(T elemental2Widget) {
    Element element = Js.cast(elemental2Widget);
    setElement(element);
  }
  public T getElemental2Widget() {
    return Js.cast(getElement());
  }
}

Now I can call it like this:

simplePanel.setWidget(new Elemental2Widget<>(htmlCanvasElement));

Is this how people mix Elemental2 with GWT widgets?  Or is there a better way?

--
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-tool...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/7a9446c7-32b5-4a1a-84ba-2c7200901122n%40googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/c1d31ce2-446c-4e2e-b228-e2215c67a5dcn%40googlegroups.com.

Wednesday, July 30, 2025

Re: Mixing Elemental2 with GWT Widgets

Craig! 
Don't worry - i am following your Elemtal2 Experience closely. It is on my to-do list for quite some time now. Thanks for sharing! 
Ralph 

Craig Mitchell <mail@craig-mitchell.com> schrieb am Do. 31. Juli 2025 um 02:37:
On the off chance someone reads the above post and thinks Elemental2 isn't very good.  Just to make it clear, Elemental2 is awesome.  Just now I needed a WeakHashMap.  GWT said no.  Elemental2 said sure can, with JsWeakMap.  Love it!

On Wednesday, 30 July 2025 at 2:34:49 pm UTC+10 Craig Mitchell wrote:
I've switched to use Elemental2 for a few things.  The rest of my app still uses the standard GWT widgets.

I can bind directly to the Elemental2 elements from the GWT UI Binder, however, if I programatically want to add an Elemental2 element to a GWT Widget, there doesn't seem to be a direct way to do this.

Eg: How would you add the Elemental2 HTMLCanvasElement, to a GWT SimplePanel using its setWidget method?

To work around this, I created an "Elemental2Widget":

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
import jsinterop.base.Js;

public class Elemental2Widget<T> extends Widget {
  public Elemental2Widget(T elemental2Widget) {
    Element element = Js.cast(elemental2Widget);
    setElement(element);
  }
  public T getElemental2Widget() {
    return Js.cast(getElement());
  }
}

Now I can call it like this:

simplePanel.setWidget(new Elemental2Widget<>(htmlCanvasElement));

Is this how people mix Elemental2 with GWT widgets?  Or is there a better way?

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/7a9446c7-32b5-4a1a-84ba-2c7200901122n%40googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/CACwwWxNVUEC0PKqWH2B1RzmuncB2Nan%3DYCbRTsnh_%2BEYqk%3Djwg%40mail.gmail.com.

Re: Mixing Elemental2 with GWT Widgets

On the off chance someone reads the above post and thinks Elemental2 isn't very good.  Just to make it clear, Elemental2 is awesome.  Just now I needed a WeakHashMap.  GWT said no.  Elemental2 said sure can, with JsWeakMap.  Love it!

On Wednesday, 30 July 2025 at 2:34:49 pm UTC+10 Craig Mitchell wrote:
I've switched to use Elemental2 for a few things.  The rest of my app still uses the standard GWT widgets.

I can bind directly to the Elemental2 elements from the GWT UI Binder, however, if I programatically want to add an Elemental2 element to a GWT Widget, there doesn't seem to be a direct way to do this.

Eg: How would you add the Elemental2 HTMLCanvasElement, to a GWT SimplePanel using its setWidget method?

To work around this, I created an "Elemental2Widget":

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
import jsinterop.base.Js;

public class Elemental2Widget<T> extends Widget {
  public Elemental2Widget(T elemental2Widget) {
    Element element = Js.cast(elemental2Widget);
    setElement(element);
  }
  public T getElemental2Widget() {
    return Js.cast(getElement());
  }
}

Now I can call it like this:

simplePanel.setWidget(new Elemental2Widget<>(htmlCanvasElement));

Is this how people mix Elemental2 with GWT widgets?  Or is there a better way?

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/7a9446c7-32b5-4a1a-84ba-2c7200901122n%40googlegroups.com.

Tuesday, July 29, 2025

Mixing Elemental2 with GWT Widgets

I've switched to use Elemental2 for a few things.  The rest of my app still uses the standard GWT widgets.

I can bind directly to the Elemental2 elements from the GWT UI Binder, however, if I programatically want to add an Elemental2 element to a GWT Widget, there doesn't seem to be a direct way to do this.

Eg: How would you add the Elemental2 HTMLCanvasElement, to a GWT SimplePanel using its setWidget method?

To work around this, I created an "Elemental2Widget":

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
import jsinterop.base.Js;

public class Elemental2Widget<T> extends Widget {
  public Elemental2Widget(T elemental2Widget) {
    Element element = Js.cast(elemental2Widget);
    setElement(element);
  }
  public T getElemental2Widget() {
    return Js.cast(getElement());
  }
}

Now I can call it like this:

simplePanel.setWidget(new Elemental2Widget<>(htmlCanvasElement));

Is this how people mix Elemental2 with GWT widgets?  Or is there a better way?

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/47b8c5cd-c1ef-496e-a75e-a552dd21c1ccn%40googlegroups.com.

Monday, July 28, 2025

Re: Elemental2 oddities

Thanks again Jens.  Issue raised:  https://github.com/google/closure-compiler/issues/4250

On Monday, 28 July 2025 at 6:55:23 pm UTC+10 Jens wrote:
Because it is only a dictionary (= a plain JS object)


In JS you simply do:

var canvas = document.getElementById('canvas');
var context = canvas.getContext('webgl', { antialias: false, stencil: true }); // 2nd argument is WebGLContextAttributes
var attributes = context.getContextAttributes();

Looks like it is again defined badly in closure-compiler externs. The generated elemental2 implementation should have a similar structure than for example elemental2 AddEventListenerOption. It is an interface with a static create() method which does exactly what you do in your solution.

See:


I think it should be @interface or @record instead of @constructor.


-- J.

Craig Mitchell schrieb am Montag, 28. Juli 2025 um 07:39:57 UTC+2:
I'm switching to use Elemental2, and it's fantastic.  All the bindings I'll ever need.  A big thank you to all that created it!

There are some strange things though.  Like when setting up a WebGLRenderingContext, we need to pass WebGLContextAttributes.

However, doing:
WebGLContextAttributes contextAttributes = new WebGLContextAttributes();

compiles fine, but at runtime throws:
TypeError: $wnd.WebGLContextAttributes is not a constructor

I figured out I can do this instead:
WebGLContextAttributes contextAttributes = Js.uncheckedCast(JsPropertyMap.of());

But why can't I just use its constructor?  Am I doing something wrong?

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/199513d3-ed5c-4d9f-a91b-21ebd465567bn%40googlegroups.com.

Re: Elemental2 oddities

Because it is only a dictionary (= a plain JS object)

https://registry.khronos.org/webgl/specs/latest/1.0/#5.2

In JS you simply do:

var canvas = document.getElementById('canvas');
var context = canvas.getContext('webgl', { antialias: false, stencil: true }); // 2nd argument is WebGLContextAttributes
var attributes = context.getContextAttributes();

Looks like it is again defined badly in closure-compiler externs. The generated elemental2 implementation should have a similar structure than for example elemental2 AddEventListenerOption. It is an interface with a static create() method which does exactly what you do in your solution.

See:

https://github.com/google/closure-compiler/blob/dc7f38bb0528b011984ef33a448c7941cf7e0b88/externs/browser/webgl.js#L2918

I think it should be @interface or @record instead of @constructor.


-- J.

Craig Mitchell schrieb am Montag, 28. Juli 2025 um 07:39:57 UTC+2:
I'm switching to use Elemental2, and it's fantastic.  All the bindings I'll ever need.  A big thank you to all that created it!

There are some strange things though.  Like when setting up a WebGLRenderingContext, we need to pass WebGLContextAttributes.

However, doing:
WebGLContextAttributes contextAttributes = new WebGLContextAttributes();

compiles fine, but at runtime throws:
TypeError: $wnd.WebGLContextAttributes is not a constructor

I figured out I can do this instead:
WebGLContextAttributes contextAttributes = Js.uncheckedCast(JsPropertyMap.of());

But why can't I just use its constructor?  Am I doing something wrong?

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/c0e8f0e3-aeb8-45e6-838f-4e56ab5fb3abn%40googlegroups.com.

Sunday, July 27, 2025

Elemental2 oddities

I'm switching to use Elemental2, and it's fantastic.  All the bindings I'll ever need.  A big thank you to all that created it!

There are some strange things though.  Like when setting up a WebGLRenderingContext, we need to pass WebGLContextAttributes.

However, doing:
WebGLContextAttributes contextAttributes = new WebGLContextAttributes();

compiles fine, but at runtime throws:
TypeError: $wnd.WebGLContextAttributes is not a constructor

I figured out I can do this instead:
WebGLContextAttributes contextAttributes = Js.uncheckedCast(JsPropertyMap.of());

But why can't I just use its constructor?  Am I doing something wrong?

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/3c576a5d-1e89-427d-8a8c-1a1c691bdf20n%40googlegroups.com.

Re: Modify the underlying HtmlUnit configuration on GWTTestCase

GWT 2.8.2 uses HTMLUnit 2.19 which should work with CORS. At least the changelog only suggest a single Chrome related fix in 2.21.

Latest GWT uses HTMLUnit 2.55 so maybe you could just override the dependency version in your project and try HTMLUnit 2.55.

It doesn't look like you can change the CORS behavior of HTMLUnit: 

https://github.com/HtmlUnit/htmlunit/blob/968027bec887ecabcdc86669b058c43c9db5562c/src/main/java/org/htmlunit/javascript/host/xml/XMLHttpRequest.java#L903

If the CORS preflight request fails to some reason you are out of luck. Maybe the CORS header is incorrect or there is some unexpected status code because of rate limiting?

-- J.

Kerby schrieb am Sonntag, 27. Juli 2025 um 11:18:22 UTC+2:
Hi, is there a way to modify the underlying HtmlUnit configuration when running GWTTestCase. My purpose is to make HtmlUnit more relaxed and not throw or ignore CORS error.

Currently, the test in my GWT library fails due to supposedly CORS error even when the server resource is returning the CORS header.

"SEVERE: Job run failed with unexpected RuntimeException: Wrapped java.lang.RuntimeException: No permitted "Access-Control-Allow-Origin" header."

App is running on GWT 2.8.2 (for Legacy Errai support)
and is using the "gwt-maven-plugin" of the same GWT version.

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/c2731566-5850-413a-b75f-d841aa8a9d31n%40googlegroups.com.

Modify the underlying HtmlUnit configuration on GWTTestCase

Hi, is there a way to modify the underlying HtmlUnit configuration when running GWTTestCase. My purpose is to make HtmlUnit more relaxed and not throw or ignore CORS error.

Currently, the test in my GWT library fails due to supposedly CORS error even when the server resource is returning the CORS header.

"SEVERE: Job run failed with unexpected RuntimeException: Wrapped java.lang.RuntimeException: No permitted "Access-Control-Allow-Origin" header."

App is running on GWT 2.8.2 (for Legacy Errai support)
and is using the "gwt-maven-plugin" of the same GWT version.

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/b1038241-9248-4f4c-a7d6-e0766da59697n%40googlegroups.com.

Saturday, July 26, 2025

Re: Errai “No proxy provider found” – but only for one model?

Kerby,

Based on the dagger release notes, the latest you can probably use will be 2.54 or 2.53.1. Our biggest project is currently using 2.51 without any issues.

Ref: https://github.com/google/dagger/releases

Look specifically for javax -> jakarta changes.

-Mike/NewsRx

On 7/26/25 11:52, Kerby wrote:
Which GWT version is currently supported? My app is stuck at 2.8.2

On Thursday, July 24, 2025 at 10:13:47 PM UTC+8 Michael Conrad wrote:

You can use Dagger for GWT dependency injection.

https://github.com/google/dagger/tree/master/gwt

On 7/20/25 18:55, Kerby wrote:

Errai isn't really like any other GWT framework. From what I know, DominoKit feels closer to GXT. Errai's big thing is that it lets you use HTML templates directly within GWT, so you're not tied to a specific UI widget library. Since it's built on top of GWT, you still get all the GWT features, but with the flexibility to work with plain HTML and CSS.

On top of that, Errai brings dependency injection to the browser, which I haven't seen in any other GWT-based framework. From what I can tell, it looks like DominoKit might even use Errai under the hood, but I'm not 100% sure on that.


Re: Errai “No proxy provider found” – but only for one model?

Which GWT version is currently supported? My app is stuck at 2.8.2

On Thursday, July 24, 2025 at 10:13:47 PM UTC+8 Michael Conrad wrote:

You can use Dagger for GWT dependency injection.

https://github.com/google/dagger/tree/master/gwt

On 7/20/25 18:55, Kerby wrote:

Errai isn't really like any other GWT framework. From what I know, DominoKit feels closer to GXT. Errai's big thing is that it lets you use HTML templates directly within GWT, so you're not tied to a specific UI widget library. Since it's built on top of GWT, you still get all the GWT features, but with the flexibility to work with plain HTML and CSS.

On top of that, Errai brings dependency injection to the browser, which I haven't seen in any other GWT-based framework. From what I can tell, it looks like DominoKit might even use Errai under the hood, but I'm not 100% sure on that.



On Friday, July 11, 2025 at 11:29:32 PM UTC+8 Frank Hossfeld wrote:
I have never used Errai, so I can't help. 

There were always a bunch of frameworks and widget libraries which offered an alternative approach to the GWT one - similar to Errai. Nowadays I would suggest looking into the DominoKit stack which is well maintained. Also Nalu might be an interesting alternative - Nalu does not offer a widget library but f.e.  works well with the one from DominoKit. And, TBH, I don't think that things like CDI, data binding, etc, needs to be provided  necessarily by GWT.  

Kerby schrieb am Mittwoch, 9. Juli 2025 um 10:52:17 UTC+2:

Hi Dmitrii, were you one of the Errai maintainers?

I'm hesitant to post on their channels—looks like Errai has been abandoned. Sadly, that's often the fate of open source under corporate backing.

Without Colin or Thomas, GWT might've died too.

For projects using Errai CDI, UI/Data Binding, or HTML Templating, this might be a dead end—unless GWT introduces similar capabilities, which seems unlikely given its focus on admin UIs and reliance on prebuilt widgets. Plus, replicating those features would be a massive effort.

Back to the issue: I just used a classic GWT value change handler, initialized it in `@PostConstruct`, and it behaves like data binder—probably how it works internally anyway.

P.S. Errai CDI really gave GWT a reactive feel.



On Wednesday, July 9, 2025 at 8:15:10 AM UTC+8 Dmitrii Tikhomirov wrote:
On Jul 8, 2025, at 5:08 PM, Craig Mitchell <ma...@craig-mitchell.com> wrote:

Unfortuntely, I don't think this is a GWT issue, I've never seen GWT throw any error like this before.  As far as I know, GWT doesn't have the concept of proxies or bound models.  Hope you find your issue.

On Tuesday, 8 July 2025 at 12:08:46 am UTC+10 Kerby wrote:

I'm getting a `No proxy provider found for bindable type` error from Errai for one specific model (`Token`), even though:


* It's annotated with both `@Bindable` and `@Portable`

* It's used with `@Model` and `DataBinder`

* It's in the same package as other models like `User`, `Post`, `Comment`, etc.


What's strange is: other models work fine and I can see them in the generated `.errai` `BindableProxyLoaderImpl`. But `Token` is missing entirely from that list — like Errai skipped it during codegen.


I already have `ErraiApp.properties`, proper module inheritance, and everything else in place.

Why would only one model get skipped like this?


Anyone encountered this before?


-- 
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-tool...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/fe847138-71f9-4cb3-a9f3-fcac54cb82d0n%40googlegroups.com.

Yes, this is an issue with Red Hat Errai, most likely because Errai hasn't been updated or tested with the latest versions of GWT in a very long time. 

To be honest, I don't even know who could help you, this framework has long been unsupported

You can try opening an issue on the Errai GitHub, but there are no guarantees.
I haven't been responsible for Errai's development and support for a long time
--
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-tool...@googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/a9d7b9d8-ab38-4293-ac01-956abe499d8en%40googlegroups.com.