0 Replies Latest reply on Apr 19, 2016 6:47 AM by christian.bauer

    [4.0.0-SNAPSHOT] StyleBinding problems

    christian.bauer

      Trying the example: http://docs.jboss.org/errai/latest/errai/reference/html_single/#sid-51806600_ErraiUI-Stylesheetbinding

       

      When the @Admin style binding method is private visibility as in the documentation (the HelloWorldForm class), this exception is thrown:

       

      java.lang.NullPointerException

              at org.jboss.errai.codegen.util.GWTPrivateMemberAccessor.makeMethodAccessible(GWTPrivateMemberAccessor.java:119)

              at org.jboss.errai.codegen.util.PrivateAccessUtil.addPrivateAccessStubs(PrivateAccessUtil.java:197)

              at org.jboss.errai.codegen.util.PrivateAccessUtil.addPrivateAccessStubs(PrivateAccessUtil.java:165)

              at org.jboss.errai.ioc.rebind.ioc.bootstrapper.AbstractBodyGenerator.addPrivateAccessors(AbstractBodyGenerator.java:590)

              at org.jboss.errai.ioc.rebind.ioc.bootstrapper.AbstractBodyGenerator.generate(AbstractBodyGenerator.java:582)

              at org.jboss.errai.ioc.rebind.ioc.bootstrapper.FactoryGenerator.generateIncrementally(FactoryGenerator.java:131)

              at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:739)


      It also seems like the style binding method is invoked at least three times for a single element.


      The Element parameter it accepts is the deprecated com.google.gwt.user.client.Element. Maybe Errai 4 major release would justify breaking this API and upgrading to elemental or Errai DOM elements.


      Injection of Navigation in the style binding method is not available, I was trying to make style decisions based on the current page.


      @Templated("#baz")

      @Page(path = "baz")

      public class Baz {

       

         private static final Logger LOG = Logger.getLogger(Baz.class.getName());

       

         @Inject
         @Admin
         @DataField
         Button deleteButton;

       

         @Inject
         Navigation navigation;

       

         @Admin
         public void applyStyle(com.google.gwt.user.client.Element element) {

         LOG.info("### THIS IS UNDEFINED: " + navigation.getCurrentPage());

        }

       

      }

       

      I'm running super dev mode with incremental compile and noprecompile: Whenever I rename the @Admin class and reload/recompile the page, frequently the style binding won't be applied and I get no error. I haven't been able to narrow it down to SDM restarts, cleaning caches, etc. Sometimes I thought also changing the style binding method/class code would make it work again, so both the @Admin and its consumer have to be recompiled, would work.