This is how I usually do it (not sure if this is the best approach).
In my View:
public class AccountDetailView {
public interface AccountDisplayDriver extends
RequestFactoryEditorDriver<AccountProxy, AccountDisplayEditor> {}
@UiField AccountDisplayEditor accountDisplayEditor;
private final AccountDisplayDriver displayDriver;
@Inject
public AccountDetailView(final Binder binder, final AccountDisplayDriver
displayDriver) {
widget = binder.createAndBindUi(this);
this.displayDriver = displayDriver;
this.displayDriver.initialize(accountDisplayEditor);
}
@Override
public AccountDisplayDriver getDisplayDriver() {
return displayDriver;
}
}
GIN will make sure that GWT.create is called on the Driver interface and
from my Presenter I can call getView().getDisplayDriver() to return the
driver and interact with it.
On Friday, November 2, 2012 11:25:05 AM UTC+1, Drew Spencer wrote:
Thanks guys! I think I will call edit() on a new instance, as this is a
> nice way of doing it.
>
> Also, are there significant benefits to re-using an editor? Mine is
> declared as final at the top of my view, then in edit() I am calling
> driver.initialize() and then driver.edit(object). That means I'm re-using
> it, right?
>
> Drew
>
> On Friday, 2 November 2012 09:32:07 UTC, Jens wrote:
>>
>> Just searched a bit and I think the post in question was
>> https://groups.google.com/d/msg/google-web-toolkit/aemVcEjK_5I/7VISroJi2VcJ
>>
>> But if its seems to be solved since GWT 2.3 it should be fine to reuse
>> the editor driver.
>>
>> -- J.
>>
>>
>> Am Freitag, 2. November 2012 03:30:36 UTC+1 schrieb Thomas Broyer:
>>>
>>>
>>> On Thursday, November 1, 2012 7:45:30 PM UTC+1, Jens wrote:
>>>>
>>>>
>>>>> +1 except you don't have to create a new editor driver, you can reuse
>>>>> a previously built one.
>>>>>
>>>>
>>>> Wasn't there a memory leak somewhere in the editor framework when you
>>>> reuse the driver? That was somewhere in my head while answering. But maybe
>>>> its already solved.
>>>>
>>>
>>> I'm not aware of anything like this (which doesn't mean there's no such
>>> issue, but it hasn't been reported)
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/IigCoNXvD14J.
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.