On Fri, Jun 4, 2010 at 5:13 AM, David <[email protected]> wrote:
> Less maintenance on the async, declarative transaction management,
> undo, batching, less web.xml tweeking, ... there are many reasons why
> we also use a command pattern.
>
With the system as it is, I believe your best bet is to make abstract class
plus *templates* of key methods. The templates are then copied down to each
subclass. An example is in GWT's showcase sample, where each content pane
implements the following method:
@Override
protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
GWT.runAsync(CwAbsolutePanel.class, new RunAsyncCallback() {
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
public void onSuccess() {
callback.onSuccess(onInitialize());
}
});
}
This method calls onInitialize() to do the work specific to each example
pane. You could imagine it also calling some other protected methods in key
places.
In general, it would be nicer if runAsync included some extra callbacks in
key places so that this kind of thing isn't necessary. Then whenever you
change the template, you could change it in one place instead of having to
modify all the copies in all the subclasses. Initially, the issue was that
it wasn't obvious what hook points people would want. At this point, the
issue is more a matter of priorities. To do it well would require surveying
what everyone is doing with runAsync and making sure the right hooks are
there for the majority of them.
Lex
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors