Proposal
Add *SimpleWidget* to gwt-incubator. The prototype has been checked into
gwt-incubator gen2 for review here.
http://code.google.com/p/google-web-toolkit-incubator/source/browse/trunk/src/com/google/gwt/gen2/commonwidget/client/SimpleWidget.java
The SimpleWidget class is modeled on SimplePanel. Its input is either a
detached Element or a String representing a detached single element. It
sinks no events on initialization, however you can add mouse and click event
handlers, in which case it will assume the underlying element supports the
given event and try to sink it.
Motivation
In almost all personal gwt programming I have done, I always end up creating
a variation of this widget to wrap static html structures in
clickable/mousable widgets. This technique minimizes the number of fluff
classes I end up creating so helps create tighter code faster then normal.
It is also a very simple widget (obviously), so is easy to use as a
poster-child for the new gwt event handler system.
*Concerns*
The primary concern is that not all elements actually do support mouse and
click events. We can certainly add an assertion that checks if the top-level
element is a member of a white listed set of element tags, but that still
means the API is, by nature, implicit rather then explicit. We, in general,
far prefer explicit apis.
So the question becomes: Is the convenience of having a simple way of
creating simple widgets without introducing additional classes into your
application worth the fact that you must magically "know" (or check the
java doc) which tags support mouse events (
Judgement matrix
At the end of simple widget's incubation we should be in one of the
following cases:
- SimpleWidget is not considered commonly useful:
- We remove SimpleWidget, as it not worth introducing a loose API if not
fully justified.
- SimpleWidget is extended from, but not directly used:
- Make SimpleWidget abstract and propose it for GWT 2.0
- SimpleWidget is commonly used, but we've gotten a few people filing
bug reports against it because they either expected to be able to use it
with attached elements or expected it to work when they passed in
non-mousable elements.
- We remove SimpleWidget, as even a couple of bug reports of that
flavor probably indicates that it is too loose of an contract.
- SimpleWidget is commonly used, people implicitly understand that it
must be used with a reasonable element.
- Make SimpleWidget abstract and propose it for GWT 2.0
--
"There are only 10 types of people in the world: Those who understand
binary, and those who don't"
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---