I have form with editors for bean fields:public class EditSampleView extends ViewImpl implements EditView, Editor<SampleData> {
interface Driver extends SimpleBeanEditorDriver<SampleData, EditSampleView> {
}
@UiField
TextFieldEditor country;
@UiField
TextFieldEditor description;
@UiField
DigitFieldEditor digit;
EditorDriver<SampleData, ? extends Editor<SampleData>> driver;
@UiField
TextFieldEditor name;
}
Each field editor has edit and view modes.
I also have own driver wrapper. It adds JSR-303 validation automation.
I want to implement this method in my driver:
/**
Sets edit/view mode of field editors
*/
public void setEditMode(boolean edit) {
for(FieldEditor field: getFieldEditors()) {
field.setEditMode(edit);
}
}
Is it possible to access all field editors from driver ?
GWT.create(Driver.class) generates code for each field editor annotated by @UiField. So it knows about all those fields. It could be great to have access to them.
The easiest is to use an EditorVisitor; it works with any kind of EditorDriver, you don't have to build your own.