Giter Site home page Giter Site logo

gwt-supereventbus's People

Contributors

arnor2000 avatar ekuefler avatar gallafent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gwt-supereventbus's Issues

Exception handling

Hi,

currently evaluating your EventBus implementation to see if I would prefer it to gwteventbinder and currently I am wondering if there is any reason why you provide a separate exception handling mechanism for the event bus?

You could have also used GWT's UmbrellaException to record exceptions occurred during event processing and then post that single UmbrellaException to GWT.getUncaughtExceptionHandler() if that handler has been set. During DevMode that handler is automatically set and logs to console.

Personally I believe that an event should never cause any exception and if it does it is totally unexpected. Well and for all unexpected exceptions I have an UncaughtExceptionHandler in place anyways that, when in production mode, sends them to the server along with additional information that help reproduce/debug the issue afterwards.

I can only hardly see any benefit in adding exception handlers to the event bus and in turn being forced to write more code just to be able to redirect these exceptions to the app's UncaughtExceptionHandler.

So any reason why the EventBus should have its own exception handling mechanism?

Subtyping doesn't work with overlay

I don't think it's a SuperEventBus bug, rather an overlay limitation but it should be at least documented.

Overlays are viewed only as JavaScriptObject and never as defined subtypes, causing all posted JSO subtypes events to be sent to all JSO subtypes subscribers.

Sources don't compile, did I forget to inherit a required module?

I wanted to try this super EventBus which looks really great but I came across a compilation error at the very beginning.

I simply inherited from com.ekuefler.supereventbus.SuperEventBus and followed the guide to post an event between two classes, nice to use!

The problem is event is never send, obviously because EventRegistrationGenerator and EventRegistrationWriter don't compile. Compiler seems to complain about almost every classes they use.

Did I forget to inherit a module?

I'm using eclipse with GPE, GWT 2.5.1 and GAE 1.8.1.1.

Compiling...
      Compilation completed in 0,00 seconds
   Added 2719 units to cache since last cleanup.
   Validating units:
      Errors in 'com/ekuefler/supereventbus/rebind/EventRegistrationGenerator.java'
         Line 40: No source code is available for type com.google.gwt.core.ext.Generator; did you forget to inherit a required module?
         Line 43: No source code is available for type com.google.gwt.core.ext.TreeLogger; did you forget to inherit a required module?
         Line 43: No source code is available for type com.google.gwt.core.ext.GeneratorContext; did you forget to inherit a required module?
         Line 44: No source code is available for type com.google.gwt.core.ext.UnableToCompleteException; did you forget to inherit a required module?
         Line 46: No source code is available for type com.google.gwt.core.ext.typeinfo.JClassType; did you forget to inherit a required module?
         Line 48: No source code is available for type com.google.gwt.user.rebind.SourceWriter; did you forget to inherit a required module?
         Line 58: No source code is available for type com.google.gwt.core.ext.typeinfo.NotFoundException; did you forget to inherit a required module?
         Line 59: No source code is available for type com.google.gwt.core.ext.TreeLogger.Type; did you forget to inherit a required module?
         Line 64: No source code is available for type com.google.gwt.core.ext.typeinfo.TypeOracle; did you forget to inherit a required module?
         Line 73: No source code is available for type com.google.gwt.user.rebind.ClassSourceFileComposerFactory; did you forget to inherit a required module?
         Line 77: The method getCanonicalName() is undefined for the type Class<EventHandlerMethod>
         Line 78: The method getCanonicalName() is undefined for the type Class<LinkedList>
         Line 79: The method getCanonicalName() is undefined for the type Class<List>
         Line 80: The method getCanonicalName() is undefined for the type Class<MultiEvent>
         Line 82: No source code is available for type java.io.PrintWriter; did you forget to inherit a required module?
      Errors in 'com/ekuefler/supereventbus/rebind/EventRegistrationWriter.java'
         Line 44: No source code is available for type com.google.gwt.core.ext.TreeLogger; did you forget to inherit a required module?
         Line 53: No source code is available for type com.google.gwt.core.ext.typeinfo.JClassType; did you forget to inherit a required module?
         Line 53: No source code is available for type com.google.gwt.user.rebind.SourceWriter; did you forget to inherit a required module?
         Line 53: No source code is available for type com.google.gwt.core.ext.UnableToCompleteException; did you forget to inherit a required module?
         Line 60: The method format(String, String) is undefined for the type String
         Line 63: No source code is available for type com.google.gwt.core.ext.typeinfo.JMethod; did you forget to inherit a required module?
         Line 74: The method getCanonicalName() is undefined for the type Class<MultiEvent>
         Line 77: The method getCanonicalName() is undefined for the type Class<capture#1-of ?>
         Line 91: The method format(String, String) is undefined for the type String
         Line 127: No source code is available for type com.google.gwt.core.ext.TreeLogger.Type; did you forget to inherit a required module?
         Line 128: The method format(String, String, String) is undefined for the type String
         Line 133: The method format(String, String, String) is undefined for the type String
         Line 139: The method getCanonicalName() is undefined for the type Class<MultiEvent>
         Line 143: The method format(String, String, String) is undefined for the type String
         Line 152: The method isAssignableFrom(Class<capture#5-of ?>) is undefined for the type Class<capture#4-of ?>
         Line 155: The method getSimpleName() is undefined for the type Class<capture#6-of ?>
         Line 155: The method getSimpleName() is undefined for the type Class<capture#7-of ?>
         Line 164: The method format(String, String, String) is undefined for the type String
         Line 182: The method getSimpleName() is undefined for the type Class<capture#9-of ?>
         Line 190: The method getCanonicalName() is undefined for the type Class<capture#10-of ?>
         Line 198: No source code is available for type com.google.gwt.core.ext.typeinfo.JType; did you forget to inherit a required module?
         Line 200: No source code is available for type com.google.gwt.core.ext.typeinfo.JPrimitiveType; did you forget to inherit a required module?
         Line 225: No source code is available for type java.lang.reflect.Constructor<T>; did you forget to inherit a required module?
         Line 225: The method getConstructors() is undefined for the type Class<capture#11-of ?>
         Line 231: No source code is available for type java.lang.SecurityException; did you forget to inherit a required module?
   Removing invalidated units

Migrate to annotation processors

Since GWT code generation will most likely be nuked with GWT 3.0, are there any plans to migrate the code generation part to annotation processors?

Could supereverntbus be more super in future?

we need to do

interface MyRegistration extends EventRegistration {}

and

eventBus.register(this, (MyRegistration) GWT.create(MyRegistration.class));

before using the @subscribe. That is boilerplate code like in gwteventbinder the Event need to extend GenericEvent.

I am also using guava EventBus with Spring in server side which let spring auto register

import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

@Component
public class EventBusPostProcessor implements BeanPostProcessor
{

@Autowired
private EventBus eventBus;

@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
{
    return bean;
}

@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
{
    // for each method in the bean
    Method[] methods = bean.getClass().getMethods();

    for (Method method : methods)
    {
        // check the annotations on that method
        Annotation[] annotations = method.getAnnotations();
        for (Annotation annotation : annotations)
        {
            // if it contains the Subscribe annotation
            if (annotation.annotationType().equals(Subscribe.class))
            {
                // register it with the event bus
                eventBus.register(bean);
                // we only need to register once
                return bean;
            }
        }
    }

    return bean;
}

}

Do you know any approach to do this ?
for example, with GIN ?

Thank you very much~!

EventRegistration should include methods from superclasses

Right now EventRegistration#getMethods only observes subscribed methods in the same class. It would be nice if it walked up the superclass hierarchy and added any annotated methods from ancestor classes as well.

Use case: I have several views that all share the same layout. I want to encapsulate the behavior of the layout (which has some events it should react to) in a superclass, and have the view classes entirely focused.

Supereventbus doesn't bind classes in parent modules

I decided to create some common views / presenters in a module that I planned to reuse in various projects. I used supereventbus to bind some interactions; in debug mode, I can see that while the events are properly posted, they are never picked up by methods in the parent module that subscribe to them.

The presenters are initialized by gin in the child modules; perhaps that's preventing them from being properly scanned by supereventbus? I can share code with you that demonstrates this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.