Hello,

I try to create editors with new editor mechanism. How do you do when
your bean property is not the same that your editor.

For example, how can I have an editor which can edit Enumeration ?

I've tried to create a RadioButtonGroup which displays values of an
enumeration and try to make this class an editor.

Here is the code: this is just a flow panel where each child is a
RadioButton

public class RadioButtonGroup<T extends Enum<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