Re: Editors framework edit/view mode question

48 views
Skip to first unread message

Thomas Broyer

unread,
Jul 15, 2012, 2:05:23 PM7/15/12
to google-we...@googlegroups.com


On Saturday, July 14, 2012 9:34:36 PM UTC+2, Олександр Бежан wrote:
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. 
Reply all
Reply to author
Forward
0 new messages