1 /**
2 * Copyright 2010 The Kuali Foundation Licensed under the
3 * Educational Community License, Version 2.0 (the "License"); you may
4 * not use this file except in compliance with the License. You may
5 * obtain a copy of the License at
6 *
7 * http://www.osedu.org/licenses/ECL-2.0
8 *
9 * Unless required by applicable law or agreed to in writing,
10 * software distributed under the License is distributed on an "AS IS"
11 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 package org.kuali.student.common.ui.client.event;
17
18 import org.kuali.student.common.ui.client.mvc.ActionCompleteCallback;
19 import org.kuali.student.common.ui.client.mvc.ApplicationEvent;
20 import org.kuali.student.common.ui.client.mvc.ApplicationEventHandler;
21
22 /**
23 * This is an abstract action event, which provides for getting/setting of
24 * an ActionCompleteCallback for any custom defined actions. ActionEvents are
25 * used to perform some action and have a action complete call back to be invoked
26 * when the action is completed so additional steps can be take when action has
27 * completed. The standard way of doing this is as follows:
28 *
29 * 1. Create an specific action event (eg. SaveActionEvent)
30 * 2. Register an ActionEventHandler (eg. SaveActionEventHandler) to perform some action (eg. save data)
31 * 3. Fire the action event with an ActionCompleteCall back to do some additional processing (eg. close save dialog or notify user)
32 *
33 * @author Kuali Student Team
34 *
35 */
36 public abstract class ActionEvent<H extends ApplicationEventHandler> extends ApplicationEvent<H>{
37 private ActionCompleteCallback actionCompleteCallback;
38
39 public ActionCompleteCallback getActionCompleteCallback() {
40 return actionCompleteCallback;
41 }
42
43 public void setActionCompleteCallback(ActionCompleteCallback actionCompleteCallback) {
44 this.actionCompleteCallback = actionCompleteCallback;
45 }
46
47 public void doActionComplete(){
48 if (actionCompleteCallback != null){
49 actionCompleteCallback.onActionComplete(this);
50 }
51 }
52
53 }