| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ChangeViewActionEvent |
|
| 1.0;1 |
| 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.application.ViewContext; | |
| 19 | ||
| 20 | ||
| 21 | /** | |
| 22 | * The ChangeViewActionEvent can be used to request the controller to change the current view to the desired view. | |
| 23 | * | |
| 24 | * @param <V> This should be the enumeration class that defines the view enum known by the controller on which this | |
| 25 | * action event is being fired upon. | |
| 26 | */ | |
| 27 | 0 | public class ChangeViewActionEvent<V extends Enum<?>> extends ActionEvent<ChangeViewActionHandler>{ |
| 28 | 0 | public static final Type<ChangeViewActionHandler> TYPE = new Type<ChangeViewActionHandler>(); |
| 29 | ||
| 30 | private V viewType; | |
| 31 | ||
| 32 | private ViewContext viewContext; | |
| 33 | ||
| 34 | /** | |
| 35 | * @param viewType The name of the view to switch to. | |
| 36 | */ | |
| 37 | 0 | public ChangeViewActionEvent(V viewType){ |
| 38 | 0 | this.viewType = viewType; |
| 39 | 0 | } |
| 40 | ||
| 41 | /** | |
| 42 | * @param viewType The name of the view to switch | |
| 43 | * @param viewContext Context information (eg. ids, actions) required by view. | |
| 44 | */ | |
| 45 | 0 | public ChangeViewActionEvent(V viewType, ViewContext viewContext){ |
| 46 | 0 | this.viewType = viewType; |
| 47 | 0 | this.viewContext = viewContext; |
| 48 | 0 | } |
| 49 | ||
| 50 | @Override | |
| 51 | protected void dispatch(ChangeViewActionHandler handler) { | |
| 52 | 0 | handler.onViewStateChange(this); |
| 53 | 0 | } |
| 54 | ||
| 55 | @Override | |
| 56 | public com.google.gwt.event.shared.GwtEvent.Type<ChangeViewActionHandler> getAssociatedType() { | |
| 57 | 0 | return TYPE; |
| 58 | } | |
| 59 | ||
| 60 | public V getViewType(){ | |
| 61 | 0 | return viewType; |
| 62 | } | |
| 63 | ||
| 64 | public ViewContext getViewContext() { | |
| 65 | 0 | return viewContext; |
| 66 | } | |
| 67 | ||
| 68 | public void setViewContext(ViewContext viewContext) { | |
| 69 | 0 | this.viewContext = viewContext; |
| 70 | 0 | } |
| 71 | } |