Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-11-02 Thread tanteanni
At the moment i read your last post/ understood the problem i knew that you tried it several times - i saw all your vehement efforts to get it into my brain (but some times brains don't want to see :-) ). i just refactored my code - in fact i haven't changed much (i already had some scheduler s

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-11-02 Thread Thomas Broyer
On Wednesday, November 2, 2011 1:46:53 PM UTC+1, tanteanni wrote: > > Thank YOU Thomas, > > i guess now i got it > Thank God! > - i don't have to "schedule" the data-loading but all the other stuff that > need to be properly "initialized", right? > Yes. Where did you read about deferring da

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-11-02 Thread tanteanni
Thank YOU Thomas, i guess now i got it - i don't have to "schedule" the data-loading but all the other stuff that need to be properly "initialized", right? Thanks for your patience (i is probably not the first time i say thx for your patience :-)). i just wanted jens to ask what happens if da

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-11-02 Thread Thomas Broyer
Grrr. onModuleLoad() { // launch task 1 // launch task 2 // display wait message, or whatever } onTask1Finished() { task1Finished = true; maybeContinue(); } onTask2Finished() { task2Finished = true; maybeContinue(); } maybeContinue() { if (task1Finished && task2Fini

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-11-02 Thread Jens
> > the problem i have with the code you suggested is: how to implement > "//wait" > Put the label into your RootPanel like in the original code. I was a bit lazy and didn't want to retype it. > as stated before my first implementation with an (infinite) while loop > could block the whole b

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-11-02 Thread tanteanni
THX for this explanation Jens! the problem i have with the code you suggested is: how to implement "//wait" as stated before my first implementation with an (infinite) while loop could block the whole browser. So whats about the other kinds of scheduleXXX? Whats about the code i showed above -

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-11-02 Thread Jens
Using SimpleEventBus the following does not behave like you expect: eventBus.addHandler(FirstEvent.TYPE, new FirstHandler() { void onFirstEvent(FirstEvent e) { //will be enqueued to be added. So handler is not fully registered eventBus.addHandler(SecondEvent.TYPE, new SecondHandler() {

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-11-02 Thread tanteanni
i found a bit of info about scheduler here. now i got: "private boolean tryToContinue() { if (ttReady && auReady) { continueStart(); return false; } else return true; }

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-11-02 Thread tanteanni
ok, thx thomas it begins to become clearer, my code attached don't use scheduler, thats right. meanwhile (thx to you thomas) i played with Scheduler and Timer. The current code looks like: " public void start() { Timer timer = new Timer() { @Override public void

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-10-28 Thread Thomas Broyer
I didn't see an Scheduler being used in the code you attached. Whichever scheduledXxx method, the idea is to get out of the "event dispatching", so the above is fine (except that your "while loop" in the ScheduledCommand can cause an infinite loop: JS is single-threaded; Also, I'd have put the

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-10-28 Thread tanteanni
so at the moment i delay it (the whole continueStart()) untill some events occur. And you propose not to delay it with scheduleDeferred (until 2 events occurred) but with scheduleFinally? Or how the code shoul look like? at the moment it is: ... new SchedulerImpl().scheduleDeferred(new ScheduledC

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-10-27 Thread Thomas Broyer
As I said: handleCurrentHistory() is called from within onAdminUnitSelected, i.e. an "event dispatch". Delay it (either just handleCurrentHistory() or the whole continueStart()) with Scheduler#scheduleFinally to make it execute *outside* the event dispatching, so that the place change handlers

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-10-27 Thread tanteanni
at the moment the "whole continueStart" is deferred at the end of this "continueStart" handleCurrentHistory() is called, after instantiating activity mappers and managers. Before that (on construction time of AppManager) EventBus and PlaceController are instantiated. you could look in the cod

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-10-27 Thread Thomas Broyer
What I meant is that, assuming you're using a SimpleEventBus, the PlaceChangeRequestHandler-s and PlaceChangeHandler-s are in the "deferredDeltas" list, they're not yet fully registered: http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/event/shared/

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-10-27 Thread tanteanni
that was my first guess but i debugged into ActivityManager's- register event code. all activity managers are instatiated and have themselve registered on placechange events before the deferred handleCurrentHistory() occurs. Or the other way around: if i do not defer the start all is working f

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-10-27 Thread Thomas Broyer
I think that's because the code now runs from within an event, so handlers addition/removal is done after the event is processed; but handleCurrentHistory() fires events synchronously, so the event handlers are not yet registered. As a workaround, defer continueStart() a bit more so it executes

Re: problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-10-27 Thread tanteanni
i made an (nearly)minimal example showing this problem. it is a simple sandbox app where i made some experiments with RequestFactory and Activities and Places (no DI, no Gin). The crux is now, that onModuleLoad is starting an AppManager.start(). The AppManager shows only "wait" until data is re

problems with loading stuff/bootstrapping onModuleLoad triggered by an event

2011-10-26 Thread tanteanni
the scenario is as follows (i use gin): - onModuleLoad instantiates a ApplicationManager and runs start() on it. - ApplicationManager sets up all activitymanagers and the layout, gives every manager some display area, sets up history handler and "start history" (historyHandler.handleCurrentHistor