nobody has an idea on how to manage enum with the new editor framework
without rewriting a class for each enum ?

I just want to create a RadioButtonGroup which is used to edit
enumeration but I don't know how to cast my enum...

Any help is welcome.

On 12 nov, 11:39, "Jerome C." <[email protected]> wrote:
> Hello,
>
> I try to create editors with neweditormechanism. How do you do when
> your bean property is not the same that youreditor.
>
> For example, how can I have aneditorwhich can edit Enumeration ?
>
> I've tried to create a RadioButtonGroup which displays values of an
> enumeration and try to make this class aneditor.
>
> Here is the code: this is just a flow panel where each child is a
> RadioButton
>
> public class RadioButtonGroup<T extendsEnum<T>> extends FlowPanel
> implements LeafValueEditor<T>
> {
>         public RadioButtonGroup()
>         {
>
>         }
>
>         @Override
>         public T getValue()
>         {
>                 T result = null;
>
>                 for (int i = 0; i < getWidgetCount(); i++)
>                 {
>                         RadioButton radio = (RadioButton) getWidget(i);
>
>                         if (radio.getValue())
>                         {
>                                 // ????????? how can I cast it ?
>                                 result = radio.getFormValue();
>                                 break;
>                         }
>                 }
>
>                 return result;
>         }
>
>         @Override
>         public void setValue(T value)
>         {
>                 for (int i = 0; i < getWidgetCount(); i++)
>                 {
>                         RadioButton radio = (RadioButton) getWidget(i);
>
>                         if (radio.getFormValue().equals(value.toString()))
>                         {
>                                 radio.setValue(true);
>                                 break;
>                         }
>                 }
>         }
>
> }
>
> thanks for any help

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to