Friday, December 9, 2016

Got UmbrellaException when trying to show loading screen on async login processing using MaterialLoading

Hello,

I have a little problem here, which I try to figure out why it is happening.

I use GWT Material Design in my project, and I just wanted to show a loading screen while the login is being processed, but I get an UmbrellaException, and the loading icon just spins there forever...

If I just remove MaterialLoader.showLoading(true); and MaterialLoader.showLoading(false); everything works.

Does anybody know why this is happening ?



private static void performUserConnection(String username, String password) {
    MaterialLoader.showLoading(true);

    DBConnectionAsync rpcService = (DBConnectionAsync) GWT.create(DBConnection.class);
    ServiceDefTarget target = (ServiceDefTarget) rpcService;
    String moduleRelativeURL = GWT.getModuleBaseURL() + "DBConnectionImpl";
    target.setServiceEntryPoint(moduleRelativeURL);

    rpcService.authenticateUser(username, password, new AsyncCallback<User>() {

        @Override
        public void onSuccess(User user) {
            MaterialLoader.showLoading(false); // Does not get here

            // ...

            if (user.getType().equals("User")) {
                presenter.goTo(new UserPlace(username));
            } else if (user.getType().equals("Admin")) {
                presenter.goTo(new AdminPlace(username));
            }
        }

        @Override
        public void onFailure(Throwable caught) {
            MaterialLoader.showLoading(false); // Does not get here

            if (caught instanceof InvalidCredentialsException) {
                MaterialToast.fireToast(caught.getMessage(), "rounded");
            } else {
                MaterialModal materialModal = ModalCreator.createModal("Something went wrong", caught);
                RootPanel.get().add(materialModal);
                materialModal.open();
            }

        }

    });
}

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

No comments:

Post a Comment