2 Replies Latest reply on Jun 14, 2013 6:23 PM by jonas.zuberbuehler

    Errai UI for adding logic to an existing webpage

    jonas.zuberbuehler

      Hi all

       

      We have a project in which the HTML pages are created externally by a web agency and we need to enhance the pages with some logic. Unfortunately we don't have access to those HTML files during compilation of our GWT code. My question is now whether the @DataField linking to a template can be done at runtime or not? So we basically tell the agency what elements need the data-field attribute and after including the nocache.js the binding works. Would that be possible?

       

      I'm also wondering if it is possible to use the errai-ui 'standalone', i.e., without bus, no Java EE back-end and no JBoss-AS. I created a small sample project in which in only included the errai-ui and errai data binding dependencies. After starting it up it complained about not being able to connect the bus.

       

      Thanks

      --jonas

        • 1. Re: Errai UI for adding logic to an existing webpage
          jfuerth

          Hi Jonas,

           

          We have a project in which the HTML pages are created externally by a web agency and we need to enhance the pages with some logic. Unfortunately we don't have access to those HTML files during compilation of our GWT code. My question is now whether the @DataField linking to a template can be done at runtime or not? So we basically tell the agency what elements need the data-field attribute and after including the nocache.js the binding works. Would that be possible?

           

          Right now, the HTML templates have to be present at compile time because they are bundled into the app as GWT resources.

           

          However, nothing else about the handling of templates would prevent what you describe. They are in fact parsed by the browser at runtime, and the lookup of the data-fields is done at runtime too. All that would need to change in the Errai implementation would be the way the template data itself is obtained before it's given to the browser for parsing.

           

          You are not the first to ask about runtime-replaceable templates. JIRA issue ERRAI-480 describes the same enhacement request.

           

          I'm not sure the exact timeline for implementing something like this, but it's becoming a popular request!

           

          I'm also wondering if it is possible to use the errai-ui 'standalone', i.e., without bus, no Java EE back-end and no JBoss-AS. I created a small sample project in which in only included the errai-ui and errai data binding dependencies. After starting it up it complained about not being able to connect the bus.

           

          Yes, this is definitely supported. You can even still use the @Inject Caller<> API to communicate with JAX-RS services if you like.

           

          To use Errai without the bus, you simply set the global JavaScript variable erraiBusRemoteCommunicationEnabled to false. See the reference guide for details: https://docs.jboss.org/author/display/ERRAI/Client+Configuration

           

          -Jonathan

          • 2. Re: Errai UI for adding logic to an existing webpage
            jonas.zuberbuehler

            Thanks a lot for your quick answer!