pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Highley <joshhigh...@gmail.com>
Subject Populate ListButton with enum data binding ?
Date Wed, 13 Apr 2016 18:26:51 GMT
I'm having an issue doing data binding with bxml.  My app has a Dialog with
a Form that shows a lot of editable fields for an object.  Using
form.load(new BeanAdapter(myObject)) is working for most of the fields
(TextInput and Checkbox) but I'm having trouble with ListButton.  I want to
populate the listData with values from an enum and then set the selected
item from a myObject value. I can't figure out how to specify the enum for
the list data in the bxml. I think I'm close:

(simplified example to mirror actual app)

public class Paint {
   public enum Color { RED, BLUE, GREEN }
}

public class Car {
    private Paint.Color color;

    public Paint.Color getExteriorColor() { return color; }
    public void setExteriorColor(Paint.Color color) { this.color = color; }
}

<ListButton selectedItemKey="exteriorColor">
    <listData>
        <collections:EnumList>
     <!-- how do I specify constructor parameter Paint.Color class here? -->
        </collections:EnumList>
    </listData>
</ListButton>


I tried 'enumClass' as an attribute of <EnumList> and a child element, but
I always get an "org.apache.pivot.serialization.SerializationException" on
the line with <collections:EnumList>


Thanks,

Josh

Mime
View raw message