Search code examples
gwtrequestfactorygwt-editors

How to edit a Set<? extends EntityProxy> with GWT Editor framework?


for sake of simplicity:

public class Person 
{
    String name; 
    Set<Address> addresses;
}

public class Address
{
     String city;
     String street;
}

with and matching

public interface PersonProxy extends EntityProxy 
{
     public String getName();
     public Set<AdressProxy> getAddresses();
}

and

public interface AdressProxy extends EntityProxy 
{
    public String getCity();
    public String getStreet();
}

I got UiBuinder classes to edit AddressProxy and it clear to me how to use ListEditor in case if I got List but data is Set in the Person class how do I use Editor Framework to edit them? Or may be how do I convert Set to List when it becomes PersonProxy?

I did an attempt to put a kind of adapter Editor class that would implement

LeafValueEditor<Set<AddressProxy>>

and then inside of the LeafValueEditor.setValue() move to a List and start a new driver.edit() on a separate Editor hierarchy that takes care of List editing but with now luck.


Solution

  • You should create a CompositeEditor<Set<AddressProxy>, AddressProxy, AddressEditor>, similar to a ListEditor but handling a Set instead of a List. I suppose you could somehow delegate to a ListEditor though I'm really not sure.