Aha! Brandon Donnelson on Gitter helped me out: I didn't know about
RootPanel.get("id"). I can add a div with a known id to the page and
attach Widgets to it via RootPanel.get("known-id").add(..). Events get
plumbed through, everything seems to work.
On Wednesday, September 6, 2017 at 9:30:27 AM UTC-7, Jonathan Fischer wrote:
>
> IMO stop using widgets is too difficult and it just forces you to actually
>> not use ANY widget
>
>
> I totally agree, but I have a ~111,000 line application that's built on
> widgets that I want to get ready for a post-widget GWT. :)
>
> If you have more questions about HAL.next or Elemento, feel free to get in
>> touch either here or at Gitter:
>
>
> Elemento's the route I'm already hoping to go. I've thrown together a
> quick minimal test to see whether Widgets and Elemental2 stuff can live
> side by side, and everything renders, but events don't seem like they get
> plumbed through to GWT widgets if I don't attach to the RootPanel:
>
> public class ElementoWidgetTest implements EntryPoint
> {
> @Override
> public void onModuleLoad()
> {
> // This is Allen Sauer's GWT logging thing
> Log.info("Hello world.");
>
> Document.get().getBody().removeAllChildren();
>
> // Quick and dirty bootstrap navbar
> HTMLElement navbar = nav().css("navbar navbar-inverse
> navbar-fixed-top").add(
> div().css("container-fluid")).asElement();
>
> navbar.addEventListener("click", (evt) -> {
> Log.info("Clicked on the navbar!");
> });
>
> // Trying to attach GWT widgets to the dom without RootPanel/RootLayoutPanel
> FlowPanel panel = new FlowPanel();
> panel.getElement().getStyle().setPaddingTop(70, Style.Unit.PX);
> Button button = new Button();
> button.setText("Hi, I'm a button.");
>
> // I've attached a click handler here, but I never see the log statements.
> Seems
> // like events don't get plumbed through to widgets if I'm not using
> RootPanel
> button.addClickHandler(event -> Log.info("Button clicked"));
> panel.add(button);
>
> Elements.body().add(navbar);
> Elements.body().add(Elements.asElement(panel));
> }
> }
>
>
> I see logging entries from clicking on the <nav> element I added, but the
> GWT Button doesn't respond.
>
>
> On Wednesday, September 6, 2017 at 5:41:13 AM UTC-7, Harald Pehl wrote:
>>
>> @Ignacio Thanks for the kind words about HAL.next
>>
>> If you have more questions about HAL.next or Elemento, feel free to get
>> in touch either here or at Gitter:
>> - https://gitter.im/hal/elemento
>> - https://gitter.im/gwtproject/gwt
>>
>> Or maybe we can have a chat at GWTCon 2017 in Florence :-)
>>
>> Am Mittwoch, 6. September 2017 11:45:41 UTC+2 schrieb salk31:
>>>
>>> +1
>>>
>>> On Wednesday, September 6, 2017 at 8:04:45 AM UTC+1, Ignacio Baca
>>> Moreno-Torres wrote:
>>>>
>>>> IMO stop using widgets is too difficult and it just forces you to
>>>> actually not use ANY widget with is super-annoying bc there are some
>>>> widgets that are still pretty useful. If you use widgets, the whole
>>>> hierarchy should be widget aware to make the widget work properly (you can
>>>> handle the lifecycle manually but it is... "even worst"). But, you can use
>>>> widgets just as a component architecture, and use elements inside this
>>>> components intensively, even you can use native events directly instead of
>>>> gwt unified events (this has some risks!). This project is developing the
>>>> whole APP trying to avoid widgets (https://github.com/hal/hal.next) or
>>>> at least using elements intensively (using elemental2 and the
>>>> user-friendly utility elemento), so you can really get inspired and get a
>>>> good conclusion on how to progressively reduce widget dependency in your
>>>> app. I have been also experimenting with widgets alternatives or
>>>> widgets(less usage)-elemental(more usage) alternatives but I haven't
>>>> concluded anything... (
>>>> https://github.com/ibaca/rxtodo-gwt/blob/widgets/src/main/java/todo/client/ApplicationElement.java
>>>> ).
>>>>
>>>> FYI Harald Pehl (https://github.com/hpehl) was already talked about
>>>> this widget-to-something in the past
>>>> https://www.youtube.com/watch?v=0cI2w-zrFbk and he is going to talk
>>>> again in this edition so be aware! (http://www.gwtcon.org/).
>>>>
>>>> Uhm... and yep, you can create HTML and use widgets only in some parts
>>>> of the HTML, this is automatically handled in UIBinder and the actual code
>>>> that handles this situation is the HTMLPanel. I have an experimental
>>>> Elemento specific version of HTMLPanel (
>>>> https://github.com/ibaca/rxtodo-gwt/blob/widgets/src/main/java/todo/client/ElementoHtmlPanel.java).
>>>>
>>>> I just copied the required code from HTMLPanel to allow to add widgets in
>>>> the internal native elements hiearchy.
>>>>
>>>> On Wednesday, September 6, 2017 at 1:16:56 AM UTC+2, Jonathan Fischer
>>>> wrote:
>>>>>
>>>>> I want/need to start porting my application away from GWT widgets, and
>>>>> for various reasons I'd like to start with the top-most shell of the
>>>>> application. Is it possible to lay out the basics of an application with
>>>>> Elemental, and then attach GWT widgets at some point within?
>>>>>
>>>>> E.g., can I do this sort of thing?
>>>>>
>>>>> <body>
>>>>> <div>My navigation goes here</div>
>>>>> <div>I want to use this as my root panel for Widgets</div>
>>>>> </body>
>>>>>
>>>>>
>>>>>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.