Hi,
I've been doing GWT MVP development lately and, while the HasText,
HasValue<T>, etc. interfaces are nice and facilitate mocking/stubbing
out views, I'm wondering why GWT doesn't go further and add per-widget
interfaces.
For example, if I have a TextBox that I want to both listen for clicks
and set its value, I need 2 methods in my view interface: HasText and
HasClickHandlers. And in the view implementation, they both return the
same TextBox field.
Each time I want a new HasXxx feature of a widget, I need yet another
boilerplate method in my view interface and implementation.
Also, there are methods in widgets that are not in HasXxx interfaces,
e.g. Hyperlink.setTargetHistoryToken, and many more widget-specific
methods don't end up in HasXxx interfaces.
Instead, if there was a single IsTextBox interface, that looked like:
public interface IsTextBox extends IsTextBoxBase, HasDirection {
int getMaxLength();
int getVisibleLength();
void setMaxLength(int length);
void setVisibleLength(int length);
}
All TextBox would have to do is add "implements IsTextBox" and now the view
interfaces can return IsTextBox just once and let the presenter do any number
of things to it in a nice decoupled-via-an-interface manner.
I'd be willing to submit a patch that adds these interfaces, or at least the
ones I've needed so far. I'm doing other fancy things (specifically generating
my entire view interface, view impl, and view stub from just the ui.xml file)
that would be made easier if widgets had their own IsXxx interfaces.
Thanks,
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
google-we...@googlegroups.com.
To unsubscribe from this group, send email to
google-web-tool...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.