Domanda

I am self learning GWT and GWTP. I am trying to set up my logging service and I want my currentUser object to be retrieved from the server before any Presenter that depends on it is revealed.

However, I have run into an issue which I think has to do with the fact that I don't understand why, on the gwtp-sample-tab example, the class CurrentUser implements HasHandlers!.

Can somebody explain it to me? Edit for a more precise question: what I would like to know is why, on the context of the sample, CurrentUser needs to implement HasHandlers. What functionality does that satisfy in the application?

Thanks a lot, Manu

PS. I am new to StackOverflow so if you think something is wrong with my question, please let me know.

È stato utile?

Soluzione

Because public class CurrentUser implements HasHandlers

because to implement the method

@Override
    public void fireEvent(GwtEvent<?> event) {
        eventBus.fireEvent(event);
    }

Which

Fires the given event to the handlers listening to the event's type.

So When a new User object creates this event register and fires at Gatekeeper(eventBus).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top