View Javadoc

1   /*
2    * Copyright 2007 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 1.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl1.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.student.common.ui.client.application;
17  
18  import org.kuali.student.common.ui.client.security.AsyncCallbackFailureHandler;
19  
20  import com.google.gwt.core.client.GWT;
21  
22  import com.google.gwt.user.client.rpc.AsyncCallback;
23  
24  /**
25   * All GWT call backs use this class, which allows us to intercept any
26   * failure and handle them appropriately.
27   * 
28   * @author Kuali Student Team
29   *
30   */
31  public abstract class KSAsyncCallback<T> implements AsyncCallback<T>{
32         
33      /**
34       * Failure is delegated to this class which is created using GWT.create().
35       * This allows implementing institution to swap out the class
36       */
37      private static final AsyncCallbackFailureHandler asyncCallbackFailureHandler = GWT.create(AsyncCallbackFailureHandler.class);
38      
39      /**
40       *  Allows institution to override this method by implementing its own 
41       *  AsyncCallbackFailureHandler. 
42       */
43      public void onFailure(Throwable caught) {  
44          asyncCallbackFailureHandler.onFailure(caught);
45      }
46      /**
47       *  Allows institution to override this method by implementing its own 
48       *  AsyncCallbackFailureHandler.
49       */
50      public void handleFailure(Throwable caught) {
51           asyncCallbackFailureHandler.handleFailure(caught);
52      }
53      /**
54       *  Allows institution to override this method by implementing its own 
55       *  AsyncCallbackFailureHandler.
56       */
57       public void handleTimeout(Throwable caught){
58           asyncCallbackFailureHandler.handleTimeout(caught);
59       }
60      /**
61       *  Allows institution to override this method by implementing its own 
62       *  AsyncCallbackFailureHandler.
63       */
64       public void handleVersionMismatch(Throwable caught){
65           asyncCallbackFailureHandler.handleVersionMismatch(caught); 
66       }
67  }