1 Reply Latest reply on Nov 14, 2017 11:41 AM by Max Barkley

    add elemntal2 to document : wrong documentation

    omid pourhadi Apprentice

      Hi,

       

      In errai refernce documentation : org.jboss.errai.common.client.dom.Document is a thin wrapper around the DOM document provided by Errai . his line assumes that TemplatedBean implements org.jboss.errai.ui.client.local.api.elemental2.IsElement. The default implementation of IsElement.getElement returns the root element of the component as an Errai DOM wrapper, which is compatible with the injected Document.

       

      I have this code which is using isElement from elemntal2

       

      @Page(role = DefaultPage.class)
      @Templated
      @ApplicationScoped
      public class WelcomePage implements 
      
      
      org.jboss.errai.common.client.api.elemental2.IsElement
      {
      
          
          @Inject
          @DataField
          HTMLDivElement div;
          
          @Override
          public HTMLElement getElement()
          {
              return div;
          }
      
      }
      
      

       

       

      and this code

       

      @Inject
          org.jboss.errai.common.client.dom.Document doc;
      
      
          @PostConstruct
          public void init()
          {
              doc.getBody().appendChild(page.getElement());
      //        Document.get().getBody().appendChild(page.getElement());
          }
      

       

      and I get compile exception :  in the type Node is not applicable for the arguments (HTMLElement)

       

      mbarkley can you help me ? am I doing sth wrong ?

       

      PS : errai version is 4.1.0.Final