PDA

View Full Version : problem with registerEventTypes()



dialloma
20 Aug 2009, 4:53 PM
Hello all,

I have a problem with registerEventTypes() in GXT 2.0.1 . When I registrer my event in my controller initialize method as I did that in GXT 1.2 it's not work. It's only work when I define it in the controller constructor. here is my controller classe:



import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.sorysys.site.administration.client.constantes.IEventsDataConstants;
import com.sorysys.site.administration.client.mvc.events.ApplicationEvents;

/**
* @author dialloma
*
*/
public class ApplicationController extends Controller {

private ApplicationView applicationView;

private String s;
public ApplicationController() {
applicationView = new ApplicationView(this);
}



@Override
protected void initialize() {
super.initialize();
registerEventTypes(ApplicationEvents.INIT);
s = "coucou";
}

/* (non-Javadoc)
* @see com.extjs.gxt.ui.client.mvc.Controller#handleEvent(com.extjs.gxt.ui.client.mvc.AppEvent)
*/
@Override
public void handleEvent(AppEvent event) {
EventType eventType = event.getType();

if (eventType == ApplicationEvents.INIT) {
String code = eventType.getEventCode()+" est le code de l'evenement declenche, " + s;

event.setData(IEventsDataConstants.BIDON, code);
forwardToView(applicationView, event);
}
}

}

Can some body help me please ?

Thanks

dialloma