hugoloza / gwt-platform

Automatically exported from code.google.com/p/gwt-platform
0 stars 0 forks source link

Events fail at PresenterWidget #441

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, I´m a new user of GWT-P and I have one problem.
This is the situation.
1. I have this event:

public class LoginEvent extends GwtEvent<LoginEvent.LoginHandler> {

    public static Type<LoginHandler> TYPE = new Type<LoginHandler>();
    private Propietario propietario;

    public interface LoginHandler extends EventHandler {
        void onLogin(LoginEvent event);
    }

    public interface LoginHasHandlers extends HasHandlers {
        HandlerRegistration addLoginHandler(LoginHandler handler);
    }

    public LoginEvent(Propietario propietario) {
        this.propietario = propietario;
    }

    public Propietario getPropietario() {
        return propietario;
    }

    @Override
    protected void dispatch(LoginHandler handler) {
        handler.onLogin(this);
    }

    @Override
    public Type<LoginHandler> getAssociatedType() {
        return TYPE;
    }

    public static Type<LoginHandler> getType() {
        return TYPE;
    }

    public static void fire(HasHandlers source, Propietario propietario) {
        source.fireEvent(new LoginEvent(propietario));
    }
}

2. I have some Presenters that implements  LoginEvent.LoginHandler with this 
method:

@ProxyEvent
@Override
public void onLogin(LoginEvent event) {
    forceReveal();
    cargarAdmin();
}

3. The previous methods makes her job successful.

4. I have various WidgetPresenter that implements LoginEvent.LoginHandler with 
her version of onLogin(...) method (similar to previous method) but this never 
is executed.

Can PresenterWidget implements a handler for events or is only for Presenter?

Is this a bug? 

Sorry for my English..

Thanks 

Original issue reported on code.google.com by gabicasas@gmail.com on 10 Oct 2012 at 11:01

GoogleCodeExporter commented 9 years ago
The answer for my own question. it doesn´t have sense to do this. The method 
forceReveal() need a slot defined for the presenter but one presenter widget 
doesn´t have this by your own nature.

Original comment by gabicasas@gmail.com on 18 Oct 2012 at 8:19

GoogleCodeExporter commented 9 years ago
Presenterwidget has to be setInSlot manually from the parent presenter. Which 
will in due time, call onBind where your event registration should be.

Original comment by goudreau...@gmail.com on 27 Nov 2012 at 2:38