How to edit set <? extends EntityProxy> with the GWT editor?

for simplicity:

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

public class Address
{
     String city;
     String street;
}

c 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 have UiBuinder classes for editing AddressProxy and it is clear to me how to use ListEditor in case I got a List, but the Set data in the Person class, how can I use the Framework editor to edit them? Or maybe, how do I convert Set to List when it becomes PersonProxy?

I tried putting an adapter adapter class that implements

LeafValueEditor<Set<AddressProxy>>

and then inside LeafValueEditor.setValue () go to the list and run the new driver.edit () in a separate Editor hierarchy, which takes care of editing the list, but with luck.

+5
source share
2 answers

CompositeEditor<Set<AddressProxy>, AddressProxy, AddressEditor>, ListEditor, Set List. , - ListEditor, .

+6

( N ):

():

@UiField
TextBox name;

@Ignore
@UiField
FlexTable listPoints;

PointsEditor pointsEditor = new PointsEditor();

     ....

pointsEditor.add(String id);

PointsEditor:

public class PointsEditor implements HasRequestContext<List<PointProxy>>, ValueAwareEditor<List<PointProxy>> {

    List<PointProxy> points = new ArrayList<PointProxy>(); 

    public void add(String id) {
       PointProxy point = ctx.create(PointProxy.class);
       point.setId(id);
       points.add(point);           
    }

( ):

@Embedded
private List<Point> points = new ArrayList<Point>();

RouteProxy

public interface RouteProxy extends EntityProxy {

       abstract List<PointProxy> getPoints();

       abstract void setPoints(List<PointProxy> points);

PointProxy

public interface PointProxy extends ValueProxy {

...

}
+3

All Articles