Editor Fields are not updating
I want to use the Editor Framework of GWT within my project.
In my View(which implements Editor) I have my UiBinder Field:
@UiField
TextBox text;
In my Presenter I inject via GIN the driver instance:
@Inject
public AppointmentPopupPresenter(EventBus eventBus, MyView view, final AppointmentDriver appointmentDriver)
When the presenter is called I try to initialize the driver with:
this.appointmentDriver.initialize(getView());
this.appointmentDriver.edit(new Appointment());
GINModule:
bind(SimpleBeanEditorDriver.class).to(AppointmentDriver.class);
AppointmentDriver interface:
public interface AppointmentDriver extends SimpleBeanEditorDriver<Appointment, AppointmentPopupPresenter.MyView>{
}
Later when I listen to a button event I call:
appointmentDriver.flush();
but all properties are null and no error msg is thrown. If I look into the debugger into the textbox widget the instanc开发者_StackOverflow中文版e of "editor" is null as well. dont know the internas but maybe this is a hint for you.
Appointment POJO(of course with void setText(String text)/String getText()):
String text;
At the moment I am completely stuck so any help is more than welcome.
Thank you!!
I see you do a getView()
, does it return the same view as the one passed to the constructor and the same as shown in the ui? It could be the driver is initialized with a different view than the one actual shown and thus you will get the data from the incorrect view. I also don't understand why you do the bind, it seems unnecessary?
I'm not sure, but I assume the problem is, that you're just calling SimpleBeanEditorDriver.initialize(E editor)
. As far as I remember, you need to call RequestFactoryEditorDriver.initialize(EventBus, RequestFactory, E)
Maybe my little (now updated for GWT 2.3, but still completely unpolished) example project can help you.
Here's the snippet where I make the initialize calls:
final MyRequestFactory requestFactory = GWT
.create(MyRequestFactory.class);
requestFactory.initialize(eventBus);
final MyEditor myEditor = new MyEditor();
driver.initialize(eventBus, requestFactory, myEditor);
It should be possible to refactor the project to use GIN.
精彩评论