• Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: ErraiIOC
    • Labels:


      It is a real pain to create and use GWT events. There is a lot of boilerplate code that must be generated, including:

      • A very heavy Event Class, with static Type class, and a bunch of required methods
      • A Handler interface needs to be created as well.

      As Errai is on a mission to eliminate boilerplace, it seems like there is good potential for Errai to help out in this area.

      This differs from CDI events, in that they are not broadcasts, but they events local to the component that is firing them (the EventBus is a @Dependent scoped bean).

      I don't event know if this is implementable as proposed, but I would be curious to get some feedback as to whether this is something that would be of interest, and if it would be difficult to do.


      The only class that needs to be created when adding a new event is the actual Event Class. Like CDI events, these are join plain POJOs. There would be ZERO boilerplace (perhaps an annotation, but that's it).

      Event Classes are annotated with an @Event annotation

      public class Selection<T> {
      	T object;

      There is an EventBus class which is @Inject ed into the component.
      The eventbus has the following interface:

      public interface EventBus {
        public E void registerHandler( EventHandler<E> handler );
        public E void fire( E event );

      The EventHandler interface is as follows:

      public interface EventHandler<T> {
      	public void handleEvent( T event );

      Putting it all together, you would have something like this:

      public class Foo {
      	@Inject EventBus eventBus;
      	public void onClick() { new Selection<Bar>( new Bar() );
      	public void addSelectionHandler( EventHandler<SelectionBar>> handler) {	

        Gliffy Diagrams




              • Assignee:
                csa Christian Sadilek
                jblinick Josh B
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: