Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7770525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:25:50+00:00 2026-06-01T16:25:50+00:00

I am trying to send an object through the gwt event bus and i

  • 0

I am trying to send an object through the gwt event bus and i don’t know why it doesn’t work.

Usually, i have a component A which creates a popup. A registers to the popup, and the popup fires the event.
Now, the listener (OtherComponent) isn’t related to the popup. When the popup fires the event, the other compoment doesn’t catch it.

Here’s my code :

Handler:

public interface MyEventHandler extends EventHandler {
   public void onChanged(MyEvent event);
}

Event :

public class MyEvent extends GwtEvent<MyEventHandler> {
  private static final GwtEvent.Type<MyEventHandler> TYPE = new GwtEvent.Type<MyHandler>();

  private MyBean my;

  public MaterielEvent(My bean) {
    my = bean;
  }

  @Override
  public com.google.gwt.event.shared.GwtEvent.Type<MyEventHandler> getAssociatedType() {
    return TYPE;
  }

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

  @Override
  protected void dispatch(MyEventHandler handler) {
    handler.onChanged(this);
  }

  public MyBean getBean() {
    return my;
  }
}

Component :

public class OtherPanel extends Composite implements HasMyEventHandlers {
  interface OtherPanelUiBinder extends UiBinder<Widget, OtherPanel> {}
  private static OtherPanelUiBinder uiBinder = GWT.create(OtherPanelUiBinder.class);

  public OtherPanel() {
    this.addMyEventHandler(new MyEventHandler() {
       @Override
       public void onChanged(MyEvent event) {
         NotificationManager.success("event recieved");
       }
    });

    initWidget(uiBinder.createAndBindUi(this));
  }

  @Override
  public HandlerRegistration addMyEventHandler(MyEventHandler handler) {
    return addHandler(handler, MyEvent.getType());
  }
}

Call (inside another component) :

  fireEvent(new MyEvent(myBean));

The notification “event received” is never called.

I surely missed something. Thanks for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:25:52+00:00Added an answer on June 1, 2026 at 4:25 pm

    You’re creating a new instance of an EventBus and defining the eventHandler on that new instance.

    I can’t see how you’re calling the fireEvent method (or from what instance of the eventBus you are calling it), but you need to have a single eventBus instance defined in your code which you pass around.

    So you instantiate an eventBus, then define any handlers you want it to have, and then have any components which will interact with eventBus accept a “MyEventHandler” as a parameter to the constructor. Then you can pass your pre-defined instance of an event bus into that component, allowing that component to later interact with the singular eventBus that your application has.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send an object of a custom class through my asmx webservice
I am trying to send an object across GWT RPC (GWT 2.4). The object
I have the following visual tree for which I am trying to send a
I am trying to convert an object to byte array & send it through
What I'm trying to do is send an object through Intents; I've been looking
I'm trying to figure out how to send a complex object through javascript to
BASIC QUESTION I am trying to send an object through socket.emit() but the object
i am trying to send an Object via socket. its object Net public class
Trying to send a complex type between two systems that have the same code
im trying to send rest api Users.getLoggedInUser i have all the secret session and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.