Tuesday, October 4, 2011

[SOLUTION] Re: Create custom callbacks to achieve synchronous code execution

Use code like:

    RunAsyncCallback getResourceItems = new RunAsyncCallback() {
        @Override
        public void onFailure(Throwable reason) {
            GWT.log(reason.getMessage());
        }

        @Override
        public void onSuccess() {
            System.out.println("THIRD");
            System.out.println("==============");
            getSlotsOfDate();
            getSessionsOfUserAndDate();
        }
    };

    RunAsyncCallback clearView = new RunAsyncCallback() {
        @Override
        public void onFailure(Throwable reason) {
            GWT.log(reason.getMessage());
        }

        @Override
        public void onSuccess() {
            Common.clearView(mainPanel);
            System.out.println("SECOND");
            GWT.runAsync(getResourceItems);
        }
    };

    private void refreshView() {
        System.out.println("FIRST");
        GWT.runAsync(clearView);
        System.out.println("LAST");
    }

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/oVFpbbeh11MJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment