+hermes

On Tue, Sep 6, 2011 at 8:35 PM,  <jus...@jhickman.com> wrote:
> I was able to test this and verified successful generation when setting
> the configuration property to true:
> <set-configuration-property name="UiBinder.useLazyWidgetBuilders"
> value="true"/>
>
> Since the implementation I'm presenting here uses the BeanParser, it
> generates code that uses the getter methods when accessing fields
> identified with <ui:with> elements.  Here is a sample of what the
> generated code looks like for the provided integration test.  (I removed
> extra line feeds to compactify a little).  In it, you can see the
> get_testX() methods are called rather than direct field access.
>

I see that, but you still have to be sure that build_test1() is called
before build_test3(), as the latter calls get_test1(). I don't think
that is guaranteed by the current UiBinder implementation of
dependencies. We tried to detect this by checking the parent field
when going through the XML, but I'm not sure we'd be able to detect
this case.

There's a part of the generated code that calls all build_*() methods.
Can you take a look and see in which order they are being called? If
you change your test template (for instance, make test1 depend on
test3 instead), does it break or does it change the order in the
generated code accordingly?

>    /**
>     * Getter for test1 called 3 times. Type: IMPORTED. Build
> precedence: 1.
>     */
>    private
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanA
> test1;
>    private
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanA
> get_test1() {
>      return test1;
>    }
>    private
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanA
> build_test1() {
>      // Creation section.
>      test1 = owner.test1;
>      // Setup section.
>      return test1;
>    }
>
>    /**
>     * Getter for test2 called 0 times. Type: IMPORTED. Build
> precedence: 1.
>     */
>    private
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanA
> get_test2() {
>      return build_test2();
>    }
>    private
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanA
> build_test2() {
>      // Creation section.
>      final
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanA
> test2 =
> (com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanA)
> GWT.create(com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanA.class);
>      // Setup section.
>      owner.test2 = test2;
>      return test2;
>    }
>
>    /**
>     * Getter for test3 called 1 times. Type: IMPORTED. Build
> precedence: 1.
>     */
>    private
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanB
> get_test3() {
>      return build_test3();
>    }
>    private
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanB
> build_test3() {
>      // Creation section.
>      final
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanB
> test3 =
> (com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanB)
> GWT.create(com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanB.class);
>      // Setup section.
>      test3.setBeanA(get_test1());
>      owner.test3 = test3;
>      return test3;
>    }
>
>    /**
>     * Getter for test4 called 0 times. Type: IMPORTED. Build
> precedence: 1.
>     */
>    private
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanC
> get_test4() {
>      return build_test4();
>    }
>    private
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanC
> build_test4() {
>      // Creation section.
>      final
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanC
> test4 = new
> com.google.gwt.uibinder.test.client.UiBinderParserUiWithTest.TestBeanC(get_test1());
>      // Setup section.
>      owner.test4 = test4;
>      return test4;
>    }
>
>
> http://gwt-code-reviews.appspot.com/1524803/
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to