pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roger and Beth Whitcomb <RogerandB...@rbwhitcomb.com>
Subject Re: Populate ListButton with enum data binding ?
Date Thu, 14 Apr 2016 17:20:54 GMT
That is a really good question, Josh.  My first thought is that you will 
probably have to populate the list in Java code.  My second thought is 
to poke through the BXMLSerializer code to see it I can figure it out.  
But, what was the complete stack trace of the SerializationException 
(i.e., the cause).  That could point the way to a solution.  But, at the 
moment I don't know the answer.

Thanks,
~Roger

On 4/13/16 11:26 AM, Josh Highley wrote:
> 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