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.mvc.events; 17 18 import org.kuali.student.common.ui.client.mvc.ApplicationEvent; 19 import org.kuali.student.common.ui.client.mvc.View; 20 21 /** 22 * "Checked" event that is fired by the controller when the view is changed 23 * 24 * @author Kuali Student Team 25 */ 26 public class ViewChangeEvent extends ApplicationEvent<ViewChangeHandler> { 27 public static final Type<ViewChangeHandler> TYPE = new Type<ViewChangeHandler>(); 28 29 private final View previousView; 30 private final View newView; 31 32 /** 33 * This constructs a new ViewChangeEvent 34 * 35 * @param previousView 36 * the previously displayed View, or null if this is the first view change 37 * @param newView 38 * the new View to be displayed 39 */ 40 public ViewChangeEvent(View previousView, View newView) { 41 super(); 42 this.previousView = previousView; 43 this.newView = newView; 44 } 45 46 /** 47 * Returns the previously displayed view, or null if this is the first view change 48 * 49 * @return 50 */ 51 public View getPreviousView() { 52 return previousView; 53 } 54 55 /** 56 * Returns the new View to be displayed 57 * 58 * @return 59 */ 60 public View getNewView() { 61 return newView; 62 } 63 64 @Override 65 protected void dispatch(ViewChangeHandler handler) { 66 handler.onViewChange(this); 67 } 68 69 @Override 70 public Type<ViewChangeHandler> getAssociatedType() { 71 return TYPE; 72 } 73 74 }