Here is the problem: I have a bean and this bean have a enum property:
enum E {
ONE, TWO, THREE;
}
class A implements Serializable {
public E foo;
}
I'd like to use GWT Editor framework to let user edit this bean
public class P extends FlowPanel implements Editor<A> {
// ... UiBinder code here ...
@UiField RadioButton one, two, three;
// ...
}
I've got an error:
[ERROR] [gwtmodule] - Could not find a getter for path one in proxy type com.company.A
[ERROR] [gwtmodule] - Could not find a getter for path two in proxy type com.company.A
[ERROR] [gwtmodule] - Could not find a getter for path three in proxy type com.company.A
Is there a way to make this work in GWT 2.2?
public class EnumEditor extends FlowPanel implements LeafValueEditor<E> {
private Map<RadioButton, E> map;
@UiConstructor
public EnumEditor(String groupName) {
map = new HashMap<RadioButton, E>();
for (E e: E.class.getEnumConstants()){
RadioButton rb = new RadioButton(groupName, e.name());
map.put(rb, e);
super.add(rb);
}
}
@Override
public void setValue(E value) {
if (value==null)
return;
RadioButton rb = (RadioButton) super.getWidget(value.ordinal());
rb.setValue(true);
}
@Override
public E getValue() {
for (Entry<RadioButton, E> e: map.entrySet()) {
if (e.getKey().getValue())
return e.getValue();
}
return null;
}
}