GWTP icon indicating copy to clipboard operation
GWTP copied to clipboard

GWT EventBinder with GWTP

Open confile opened this issue 10 years ago • 3 comments

It would be a great improvement to make GWT EventBinder http://google.github.io/gwteventbinder/ work with GWTP.

I think it works but you need an annotation for the following method:

addVisibleHandler(GlobalDataEvent.getType(), this);

This could be something like

@VisibleHandler
@EventHandler
  void onEmailLoaded(EmailLoadedEvent event) {
    view.setSubject(email.getSubject());
    view.setBody(email.getBody());
  }

It would be great to have this type of annotation.

confile avatar Aug 17 '14 18:08 confile

looks cool, wrt visibile handlers, is this just an optimization for performance or is there some other reason for having it?

How much of a performance difference does it really make?

On Sun, Aug 17, 2014 at 8:03 PM, Confile [email protected] wrote:

It would be a great improvement to make GWT EventBinder http://google.github.io/gwteventbinder/ work with GWTP.

I think it works but you need an annotation for the following method:

addVisibleHandler(GlobalDataEvent.getType(), this);

This could be something like

@VisibleHandler @EventHandler void onEmailLoaded(EmailLoadedEvent event) { view.setSubject(email.getSubject()); view.setBody(email.getBody()); }

It would be great to have this type of annotation.

— Reply to this email directly or view it on GitHub https://github.com/ArcBees/GWTP/issues/547.

rdwallis avatar Aug 18 '14 05:08 rdwallis

Performance and there's a lot of use case where people use an event that must be handled only by the active Presenter. When someone does that, they need to add a conditional logic to its handler. But with visible handlers, there's no need to do that.

It is cool indeed. I'm not using it because I don't think events should be generated. And also because it doesn't extends GWTEvent which is needed if you want to use @UiHandler on custom events.

Here's a great article: http://www.javatronic.fr/2014/05/21/java_bean_mapping_is_wrong_lets_fix_it.html

It is about java beans and events to me are like java beans which is why I like this point of view.

christiangoudreau avatar Aug 18 '14 12:08 christiangoudreau

Oh! Also, it is sometime useful to throw Events on a widget local event bus, which also requires GWTEvents.

christiangoudreau avatar Aug 18 '14 12:08 christiangoudreau