> We do have views where we do not need an "asWidget" method: those that
> are actually DialogBox or similar and therefore just have show/hide
> methods.
Ah, sure, I didn't think of that; I'm using DialogBox as well. Even
without an explicitly-needed "asWidget" method, it's still Widget-
based, so I think my assumption is okay.
> But I'm not sure our approach is the best (I also thought
> about using a "widget view" and then the "parent controller" would
> create the DialogBox and set the child view's asWidget() as the dialog
> content).
This is what I ended up doing--I have an FAQ lightbox that uses
DialogBox. The faq content is in an FaqView.ui.xml, and then
FaqPresenter creates an box = widgets.newDialogBox(), then does
box.setWidget(display), box.center(), box.show().
I can still unit test it because I have a Widgets factory interface
that returns IsDialogBox, that in production returns gwt DialogBox,
and in testing returns StubDialogBox.
And that works pretty well, but then in another place I ended up
putting the PopupPanel right into the ui.xml file. E.g.
DatePickerPopup.ui.xml:
<ui:UiBinder
xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:gwt="urn:import:com.google.gwt.user.client.ui"
xmlns:dp="urn:import:com.google.gwt.user.datepicker.client">
<gwt:PopupPanel ui:field="popup">
<gwt:FocusPanel ui:field="focus">
<dp:DatePicker ui:field="datePicker" />
</gwt:FocusPanel>
</gwt:PopupPanel>
</ui:UiBinder>
And then the presenter calls display.popup().show() when appropriate.
I'm not sure which one I like better. The 2nd avoids the extra call to
the Widgets factory, so I might lean towards it going forward.
- Stephen
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
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.