View Javadoc

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.HasActionState;
19  
20  /**
21   * A save event with user defined save types. This allows a single widget to handle
22   * different types of save events without having to create new events and handlers. 
23   * 
24   * @author Kuali Student Team
25   *
26   */
27  public class SaveActionEvent extends ActionEvent<SaveActionHandler> implements HasActionState{
28      public static final Type<SaveActionHandler> TYPE = new Type<SaveActionHandler>();
29      
30      private ActionState actionState;
31      private String message = "Saving";
32      private boolean acknowledgeRequired = true;
33      private boolean gotoNextView = false;
34      private boolean saveSuccessful = false;
35      
36      public SaveActionEvent(){
37      }
38      
39      public SaveActionEvent(boolean gotoNextView){
40      	this.gotoNextView = gotoNextView;
41      }
42      
43      public SaveActionEvent(String message){
44          this.message = message;
45      }    
46     
47      @Override
48      protected void dispatch(SaveActionHandler handler) {
49          handler.doSave(this);
50      }
51  
52      @Override
53      public Type<SaveActionHandler> getAssociatedType() {
54          return TYPE;
55      }
56          
57  
58      public void setActionState(ActionState state){
59          this.actionState = state;
60      }
61      
62      /**
63       * @see org.kuali.student.common.ui.client.mvc.HasActionState#getActionState()
64       */
65      @Override
66      public ActionState getActionState() {
67          return this.actionState;
68      }
69      
70      public String getMessage(){
71          return message;
72      }
73  
74      public boolean isAcknowledgeRequired() {
75          return acknowledgeRequired;
76      }
77  
78      public void setAcknowledgeRequired(boolean acknowledgeRequired) {
79          this.acknowledgeRequired = acknowledgeRequired;
80      }
81      
82      public boolean gotoNextView(){
83      	return gotoNextView;
84      }
85  
86  	public void setGotoNextView(boolean gotoNextView) {
87  		this.gotoNextView = gotoNextView;
88  	}
89  
90  	public void setSaveSuccessful(boolean saveSuccessful) {
91  		this.saveSuccessful = saveSuccessful;
92  	}
93  
94  	public boolean isSaveSuccessful() {
95  		return saveSuccessful;
96  	}
97      
98  }