}.schedule(1);
}
}
);
final ListenerRegistration listenerRegistration
= entity.getState().addStateChangeListener(new StateChangeListener() {
@Override
public int getCursorPos() {
return widget.getCursorPos();
}
@Override
public void onStateChange(final int newCursorPos, final Object newValue) {
if (NO_PROPAGATE_STATE_CHANGE) {
return;
}
widget.setValue(newValue, false);
widget.setCursorPos(newCursorPos);
}
});
DOM.sinkEvents(widget.getElement(), DOM.getEventsSunk(widget.getElement()) | Event.ONPASTE);
final Timer timer = new Timer() {
@Override
public void run() {
entityChangeStream.flush();
}
};
timer.scheduleRepeating(500);
return new AtomizerSession() {
@Override
public void end() {
entityChangeStream.close();
timer.cancel();
logger.info("END ATOMIZER SESSION");
entityStreamRegistration.remove();
listenerRegistration.remove();
final Collection<HandlerRegistration> values = HANDLER_REGISTRATION_MAP.values();
for (final HandlerRegistration value : values) {
value.removeHandler();
}
}