Reputation: 3554
I'm using GWT-Platform in my project, and I want to check what Widget called some Handler, for example, a BlurHandler.
The reason for my question is below. This BlurHandler is registred by four TextField.
@Override
public void addFormatTextBoxListener(BlurHandler handler) {
tbAlt.addBlurHandler(handler);
tbLat.addBlurHandler(handler);
tbMedida.addBlurHandler(handler);
tbLong.addBlurHandler(handler);
}
In my Presenter I want to find what field(Widget) lost the focus(Result of BlurEvent).
getView().addFormatTextBoxListener(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
doFormatTextBox();
}
});
private void doFormatTextBox() {
//who called me???
}
The method doFormatTextBox will be called when one of the four Widget's lost focus. But what Widget losted focus?
Upvotes: 0
Views: 140
Reputation: 7154
Redading the Event API (http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/Event.html)
it seams as though Element e1 = event.getTarget()
and then doing if (e1.equals(widget1.getElement())){//do stuff...}
should work.
This is assuming BlurEvent extends com.google.gwt.user.client.Event
which I'm not completely sure.
Upvotes: 1