public void handleEvent(BoxComponentEvent be) {
user = dlg.getUser();
if (directLink == null) {
Dispatcher.forwardEvent(WPaloEvent.INIT, user);
} else {
final Dispatcher dispatcher = Dispatcher.get();
final String locale = Window.Location.getParameter("locale");
WPaloServiceProvider.getInstance().openViewAfterLogin(locale, user.getSessionId(), directLink,
new AsyncCallback<XDirectLinkData>() {
public void onSuccess(final XDirectLinkData data) {
if (!data.isAuthenticated()) {
dispatcher.dispatch(WPaloEvent.APP_START);
if (data.getErrors().length > 0) {
StringBuffer buf = new StringBuffer();
for (String s: data.getErrors()) {
buf.append(s + "\n");
}
MessageBox.alert(constants.errorsWhileProcessingOptions(),
buf.toString(), null);
}
} else {
// CubeViewEditor.fromDirectLink = true;
XView [] xViews = data.getViews();
if (xViews == null || xViews.length == 0) {
dispatcher.dispatch(WPaloEvent.INIT, DisplayFlags.createDisplayFlags(user, data.getGlobalDisplayFlags()));
directLogin(user);
if (data.getErrors().length > 0) {
StringBuffer buf = new StringBuffer();
for (String s: data.getErrors()) {
buf.append(s + "\n");
}
MessageBox.alert(constants.errorsWhileProcessingOptions(), buf.toString(), null);
}
return;
}
LargeQueryWarningDialog.hideWarnDialog = true;
for (int i = 1; i < xViews.length; i++) {
((WorkbenchController) getController()).getViewBrowserController().
addViewToLoad(xViews[i]);
}
XView xView = xViews[0];
DisplayFlags.setDisplayFlagsFor(xView, user, xView.getDisplayFlags(), data.getGlobalDisplayFlags());
DisplayFlags displayFlags = DisplayFlags.getDisplayFlagsFor(xView);
dispatcher.dispatch(WPaloEvent.INIT, displayFlags);
directLogin(user);
// CubeViewEditor.hasBeenResized = true;
dispatcher.dispatch(WPaloEvent.EDIT_VIEWBROWSER_VIEW, xView);
if (data.getErrors().length > 0) {
StringBuffer buf = new StringBuffer();
for (String s: data.getErrors()) {
buf.append(s + "\n");
}
MessageBox.alert(constants.errorsWhileProcessingOptions(), buf.toString(), null);
}
}
}
public void onFailure(Throwable arg0) {
dispatcher.dispatch(WPaloEvent.APP_START);
}
});
}
}
});