}
);
bus.addSubscribeListener(this);
Controller mainController = new com.mvc4g.client.Controller();
Registry.set(Controller.class, mainController);
// ------
// setup base urls
String proxyUrl = null;
if (!GWT.isScript())
{
proxyUrl = GWT.getModuleBaseURL() + "xhp";
}
final ConsoleConfig config = new ConsoleConfig(proxyUrl);
ConsoleLog.debug("Console server: " + config.getConsoleServerUrl());
URLBuilder.configureInstance(config);
// ------
ApplicationContext appContext = new ApplicationContext()
{
public void displayMessage(String message, boolean isError)
{
if(isError)
MessageBox.error("Error", message);
else
MessageBox.alert("Warn", message);
}
public Authentication getAuthentication()
{
return Registry.get(Authentication.class); // set in login view
}
public ConsoleConfig getConfig()
{
return config;
}
public void refreshView()
{
}
};
Registry.set(ApplicationContext.class, appContext);
// ------
registerGlobalViewsAndActions(mainController);
mainController.addAction("login", new LoginAction());
mainController.addAction(BootstrapAction.ID, new BootstrapAction());
mainController.addView("loginView", new LoginView());
// bootstrap
/* mainController.handleEvent(
new com.mvc4g.client.Event(BootstrapAction.ID, Boolean.TRUE)
);*/
//login
mainController.handleEvent(new Event("login", null));
}