title: Differentiate events for multiple attached gwt widgets
body: <p>I've been trying to make multiple Presenters "listen" to the same event but I which to make each event unique to the Presenter.</p>
  
  <p>Ex. 
  I create 3 Composite widgets each in one different tab. They get all attached to the same event at binding. Let's call it the "NewPrescriptionEvent". If this event is fired, all my 3 composites will try to <strong>DO</strong> the job. I only want one of them to do it.</p>
  
  <p>The only way I found to do this is by creating a temp event id (an integer inside the event) which I check for each widget which is trying to respond to the event.</p>
  
  <p><strong>Code snippet</strong></p>
  
  <pre><code>private class OnNewPrescription implements NewPrescriptionHandler {
  
      @Override
      public void onNewPrescription(NewPrescriptionEvent event, int dataObjectId) {
  
          if (getDataObject().getPatientId() == dataObjectId) {
          ...
          }
      }
  }
  </code></pre>
  
  <p>During binding I do the usual:</p>
  
  <pre><code>eventBus.addHandler(NewPrescriptionEvent.TYPE, new OnNewPrescription());
  </code></pre>
  
  <p>The event:</p>
  
  <pre><code>public class NewPrescriptionEvent extends GwtEvent&lt;NewPrescriptionHandler&gt; {
  
      public static final GwtEvent.Type&lt;NewPrescriptionHandler&gt; TYPE = new GwtEvent.Type&lt;NewPrescriptionHandler&gt;();
  
      private int dataObjectId;
  
      public NewPrescriptionEvent(int dataObjectId) {
          this.dataObjectId = dataObjectId; 
      }
  
      @Override
      protected void dispatch(NewPrescriptionHandler handler) {
          handler.onNewPrescription(this, dataObjectId);      
      }
  
      @Override
      public GwtEvent.Type&lt;NewPrescriptionHandler&gt; getAssociatedType() {
          return TYPE;
      }
  }
  </code></pre>
  
  <p>I was thinking that the TYPE need to be different each time but still be the same event. Does anyone have a suggestion?</p>
  
  <p>Thx.</p>