attachEventHandlers(buffer);
hasFocus = inputElement.equals(Elements.getActiveElement());
}
private void attachEventHandlers(Buffer buffer) {
inputElement.addEventListener(Event.FOCUS, new EventListener() {
private final Dispatcher<FocusManager.FocusListener> dispatcher =
new Dispatcher<FocusManager.FocusListener>() {
@Override
public void dispatch(FocusListener listener) {
listener.onFocusChange(true);
}
};
@Override
public void handleEvent(Event evt) {
hasFocus = true;
focusListenerManager.dispatch(dispatcher);
}
}, false);
inputElement.addEventListener(Event.BLUR, new EventListener() {
private final Dispatcher<FocusManager.FocusListener> dispatcher =
new Dispatcher<FocusManager.FocusListener>() {
@Override
public void dispatch(FocusListener listener) {
listener.onFocusChange(false);