The following test case passes:

public void testCollectionSubProperties() {
    delayTestFinish(DELAY_TEST_FINISH);
    simpleFooRequest().getSimpleFooWithSubPropertyCollection().with(
        "selfOneToManyField.fooField").fire(new Receiver<SimpleFooProxy>() {
      @Override
      public void onSuccess(SimpleFooProxy response) {
        assertEquals("I'm Here",

 response.getSelfOneToManyField().get(0).getFooField().getUserName());
      }
    });
  }

on the server:
 public static SimpleFoo getSimpleFooWithSubPropertyCollection() {
    SimpleFoo foo = new SimpleFoo();
    SimpleFoo subFoo = new SimpleFoo();
    SimpleFoo subSubFoo = new SimpleFoo();
    subFoo.setFooField(subSubFoo);
    subSubFoo.setUserName("I'm here");
    subSubFoo.persist();
    subFoo.persist();
    foo.persist();
    foo.setSelfOneToManyField(Arrays.asList(subFoo));
    return foo;
  }

If you have a class that looks like this:

public class Company {
   List<Office> offices;
}

public class Office {
  Employee siteManager;
}

Then the correct way to query for siteManager is:

with("offices.siteManager")

With is a nothing more than a filter on names, it doesn't care if something
is a collection, or an entity, just whether or not the name matches.

-Ray

On Mon, Oct 4, 2010 at 2:32 PM, BobV <b...@google.com> wrote:

> Your feedback has been very helpful in finding out where the weak
> points in our APIs and implementations are.
>
> > driver.getPath() isn't able to completely scan an editor tree when it
> > contains CompositeEditor's that, they themselves, have more editors in
> > their hierarchy
>
> I'm thinking about how to solve this one, since an uninitialized
> CompositeEditor won't have any sub-editors to query.
>
> > It's not possible to request sub-properties when using collections
> > manually.  It just doesn't work.  The example I gave were trying to
> > get the name of an office inside a collection, putting
>
> RayC is looking at this.
>
> --
> Bob Vawter
> Google Web Toolkit Team
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>

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

Reply via email to