Re: Custom Events and Elements with Elemental 2

2017-10-17 Thread James Nelson
Also, feel free to ignore the bit of insanity around virtual shadow roots. That's just something I built because an older version of webcomponentjs was severely borked, and I needed to... make my own virtual shadow DOM implementation. I have allowed it to survive after upstream bug was fixed

Re: Custom Events and Elements with Elemental 2

2017-10-17 Thread James Nelson
It is possible to create web components with "fake" ES2015 classes built out of raw javascript. https://github.com/WeTheInternet/xapi/blob/master/gwt/components/src/main/java/xapi/components/impl/WebComponentBuilder.java#L108 Note that the library above depends on a custom fork of Gwt that is

Re: Custom Events and Elements with Elemental 2

2017-10-13 Thread Thomas Broyer
Web Components require using ES2015 class syntax, so you would need some trickery make them work from GWT (see https://github.com/webcomponents/custom-elements#es5-vs-es2015 or https://github.com/webcomponents/webcomponentsjs#custom-elements-es5-adapterjs) At least this is the theory… On

Re: Custom Events and Elements with Elemental 2

2017-10-13 Thread nikola
Thanks for the link.. But I can't see what I was looking for.. Can someone please create and register custom web component using only elemental 2. e.g that says "hello from shadow DOM!". Cause I'm not able to do it or find working example .. at least without losing whole week on it... Thanks

Re: Custom Events and Elements with Elemental 2

2017-10-12 Thread harshyadav
You can try the GWT polymer (web components) wrapper: https://github.com/manolo/gwt-polymer-elements Wither you can use built-in polymer components; or create your own (just look at the source code) Also take a look at: https://github.com/manolo/gwt-api-generator which auto generates GWT api

Re: Custom Events and Elements with Elemental 2

2017-10-12 Thread nikola
Ok, Thanks! I'll try with web components. As a java programer I'v been trying to avoid digging too much in javascript but it's inevitable it seems :) On Thursday, October 12, 2017 at 12:43:56 PM UTC+2, Thomas Broyer wrote: > > This is not how the DOM works I'm afraid. How would your proposed

Re: Custom Events and Elements with Elemental 2

2017-10-12 Thread Thomas Broyer
This is not how the DOM works I'm afraid. How would your proposed code would translate to JS? (feel free to use ES2015 classes for clarity) (btw, I really do think Web Components would solve your issues, as I see them) On Thursday, October 12, 2017 at 12:21:11 PM UTC+2, nikola wrote: > > > When

Re: Custom Events and Elements with Elemental 2

2017-10-12 Thread nikola
When I say "custom element" I mean: *public class *CustomElement *implements *IsElement { *//private HandlerManager handlerManager; ? *List *someUserObject*; *//state object of CustomElement *HTMLElement *root *= Js.*cast* (DomGlobal.*document*.createElement(*"div"*));

Re: Custom Events and Elements with Elemental 2

2017-10-12 Thread Thomas Broyer
On Wednesday, October 11, 2017 at 4:12:14 PM UTC+2, nikola wrote: > > > Users would expect to have events with source from where event was > fired. That was source field in GWT events. In your implementation we will > need to intercept DOM event and fire new event with source field of custom

Re: Custom Events and Elements with Elemental 2

2017-10-11 Thread nikola
Users would expect to have events with source from where event was fired. That was source field in GWT events. In your implementation we will need to intercept DOM event and fire new event with source field of custom element. (e.g re-fire through EventHandler). This is kind of double work.

Re: Custom Events and Elements with Elemental 2

2017-10-11 Thread Harald Pehl
We still use the GWT event bus for custom / application scoped events. To listen to DOM event we use what's provided by Elemental2. We use a simple interface [1] which is part or Elemento [2] to create custom elements. [1]

Custom Events and Elements with Elemental 2

2017-10-11 Thread nikola
*custom events:* Do we still need EventBus or what was HandlerManager for widgets to fire and create custom events or we should use element's *addEventListener *and native custom events? *custom element:* I'm missing Composite from GWT Widgets and its *initWidget() *method. Any idea how