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 7846571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:37:32+00:00 2026-06-02T17:37:32+00:00

i have an activity that needs another class’ service to retrieve some data (DataClass).

  • 0

i have an activity that needs another class’ service to retrieve some data (“DataClass”). This data class can be called to fetch data and will fire an event on success.
the first time that activity need the data is on “start” – to resolve the state brought by the current place and update the view accordingly.

the problem is that the activities onDataEvent method isn’t called the first time but on alle subsequent events. I checked the event’s handlers. On time the first event is fired the activity is registered with this event. I also tried to register the event withing constructor but this changes nothing.
So how to register an activity for an event, trigger and react on it within the start method? Or how to generally implement such an use case.

EDIT
in meantime i tried to implement it like here but with no success.

here is the code of the start method:

    @Override
public final void start(final AcceptsOneWidget panel, final com.google.gwt.event.shared.EventBus eventBus) {
    this.eb = new ResettableEventBus(eventBus);
    if (!(pc.getWhere() instanceof DynamicTablePlace)) {
        throw new IllegalStateException(CreateDynamicTableActivity.class.getName() + " should only be called on "
                                        + DynamicTablePlace.class.getName());
    }
    view.setPresenter(this);
    this.eb.addHandler(DynamicTableHashResolvedEvent.TYPE, this);
    stateResolver.resolveState(((DynamicTablePlace) pc.getWhere()).getTablehash(), eb); //this is triggering the event
    panel.setWidget(view);
}

the onDynamicTableHashResolved(DynamicTableHashResolvedEvent event) method isn’t called the first time but on all subsequent events.

  • 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-02T17:37:34+00:00Added an answer on June 2, 2026 at 5:37 pm

    in google groups someone pointed me on the problem. I already stumbled across this kind of problem. The problem is: if the browser handles some events (the activities start method is called upon a place change event) and you register another event within this process and trigger the event just registered it will not work – the registration is not “complete” at this moment.
    The solution is simple: trigger the event “deferred” in my code:

            Scheduler.get().scheduleFinally(new ScheduledCommand() {
            @Override
            public void execute() {
                stateResolver.resolveState(((DynamicTablePlace) pc.getWhere()).getTablehash(), eb);
    
            }
        });
    

    The problem is: this breaks test-ability (without gwt test case) of this activity.

    from Thomas Broyer: if scheduler is injected i can normally test and there is a StubScheduler provided for use in test. in my case i created a mock for scheduler that just executes the command – in my case only scheduleFinally(ScheduledCommand cmd) must be implemented.

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

Sidebar

Related Questions

I have two class, one is an activity that can handle Chronometer, another is
I have a non-Activity class (let's call it NonActivity) that needs to post a
I have an activity that lets the user load some data when they press
In one class, I have to call a constructor of another class that needs
Right. I have an action that needs to call another activity. As I understand
I have work that needs to be done in this order: In main activity:
I have an activity that launches another activity with startActivityForResult method. I would like
I have an activity that runs some ASCII control over a network port to
I have a fragment view that needs replacement with another fragment. When the ListFragment
I need to have a class with one activity that is performed once per

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.