the parameter of the method addHandler

30 views
Skip to first unread message

wahaha

unread,
Dec 6, 2011, 10:58:01 PM12/6/11
to Google Web Toolkit
in class Widget,there is a method addHandler(final H handler,
GwtEvent.Type<H> type).
in a customer defined Widget which has a customer defined event,i call
the method addHandler(final H handler, GwtEvent.Type<H> type),and
transmit parameter like this:
addHandler(handler,new Type<XxxHandler>)
but the customer defined event do not take effect at all at the last.
i modified it like this: addHandler(handler,MyEvent.getType),and in
the MyEvent class:
public Type<XxxHandler> getType() {
if(type==null){
type=new Type<XxxHandler>();
}
return type;
}
now,it have no problem.
why?does it will inject the value for "type" auto automatically ?

Ashton Thomas

unread,
Dec 7, 2011, 1:35:07 AM12/7/11
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages