If you want to run ValueChangeEvent , you must implement the HasValueChangeHandlers interface or your class or somewhere in the class.
A simple implementation would be to use EventBus:
EventBus bus = new SimpleEventBus(); @Override public void fireEvent(GwtEvent<?> event) { bus.fireEvent(event); } @Override public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler) { return bus.addHandler(ValueChangeEvent.getType(), handler); }
Note that you need to replace T type you want to run.
Since you cannot create a ValueChangeEvent, direct event dispatch is performed using the fire method:
ValueChangeEvent.fire(this, value);
Where this refers to a class / field that implements HasValueChangeHandlers and value , refers to the value that was changed, and you want to send the event.
Hilbrand Bouwkamp Aug 2 '11 at 9:30 a.m. 2011-08-02 09:30
source share