Package com.tensegrity.wpalo.client.ui.dialog

Examples of com.tensegrity.wpalo.client.ui.dialog.LoginDialog


    final String directLink = Window.Location.getParameter("options");
    String usr = null;
    if (directLink != null) {
      usr = getValue("user", directLink);
    }
    final LoginDialog dlg = new LoginDialog(usr);   
    dlg.addListener(Events.Hide, new Listener<BoxComponentEvent>() {
      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);
                }
              });         
        }
      }
    });
    WPaloPropertyServiceProvider.getInstance().getBooleanProperty("isPaloSuite", false, new AsyncCallback<Boolean>() {
      public void onFailure(Throwable arg0) {
        ((WPalo) Registry.get(WPalo.ID)).show(dlg);
        dlg.show();       
      }

      public void onSuccess(Boolean result) {
        if (!result) {
          ((WPalo) Registry.get(WPalo.ID)).show(dlg);
          dlg.show();         
        }
      }
    });
   
  }
View Full Code Here

TOP

Related Classes of com.tensegrity.wpalo.client.ui.dialog.LoginDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.