Hello 
I want to initialize my widget by data. I sent by eventbus to them event 
indicating that there is new object. I tried to work with eventbus in 3 
ways 

1:    
for(Unit unit : createTestData()){
eventBus.fireEvent(new ScenarioElementEvent(new 
UnitStoreElement<Unit>(unit, null), ScenarioElementEventType.ADDED, 
ScenarioElementEventObjectType.GEO_OBJECT));
}

2:  
Timer t = new Timer() {
 @Override
public void run() {
List<Unit> units = createTestData();
Console.log(Level.INFO,"Test data have " + units.size());
for(int i = 0; i < units.size(); i ++){
Unit unit = units.get(i);
Console.log(Level.INFO,"Fire event " + i + " " + unit.getDescription());
eventBus.fireEvent(new ScenarioElementEvent(new 
UnitStoreElement<Unit>(unit, null), ScenarioElementEventType.ADDED, 
ScenarioElementEventObjectType.GEO_OBJECT));
}
}
};
t.schedule(1);


3:
List<Unit> units = createTestData();
for(int i = 0; i < units.size(); i ++){
final Unit unit = units.get(i);
Console.log(Level.INFO,"Fire event " + i + " " + unit.getDescription());
Timer t = new Timer(){

@Override
public void run() {
eventBus.fireEvent(new ScenarioElementEvent(new 
UnitStoreElement<Unit>(unit, null), ScenarioElementEventType.ADDED, 
ScenarioElementEventObjectType.GEO_OBJECT)); 
}
 };
t.schedule(1);
}
}


Only third works. 
First - no one handler is notified
Second - only one event is send.

Can anybody say why?
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to