Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SelectionChangeEvent |
|
| 1.3;1.3 |
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.widgets.list; | |
17 | ||
18 | import com.google.gwt.event.shared.GwtEvent; | |
19 | import com.google.gwt.user.client.ui.Widget; | |
20 | ||
21 | /** | |
22 | * This is a description of what this class does - Will Gomes don't forget to fill this in. | |
23 | * | |
24 | * @author Kuali Student Team | |
25 | * | |
26 | */ | |
27 | 0 | public class SelectionChangeEvent extends GwtEvent<SelectionChangeHandler> { |
28 | ||
29 | private static Type<SelectionChangeHandler> TYPE; | |
30 | private Widget widget; | |
31 | 0 | private boolean userInitiated = true; |
32 | ||
33 | /** | |
34 | * Used to fire a SelectionChangeEvent | |
35 | * | |
36 | */ | |
37 | public static void fire(Widget source) { | |
38 | 0 | if (TYPE != null) { |
39 | 0 | SelectionChangeEvent event = new SelectionChangeEvent(source); |
40 | 0 | source.fireEvent(event); |
41 | ||
42 | } | |
43 | 0 | } |
44 | ||
45 | /** | |
46 | * Used to fire a SelectionChangeEvent | |
47 | * | |
48 | */ | |
49 | public static void fire(Widget source, boolean userInitiated) { | |
50 | 0 | if (TYPE != null) { |
51 | 0 | SelectionChangeEvent event = new SelectionChangeEvent(source); |
52 | 0 | event.setUserInitiated(userInitiated); |
53 | 0 | source.fireEvent(event); |
54 | ||
55 | } | |
56 | 0 | } |
57 | ||
58 | 0 | public SelectionChangeEvent(Widget widget){ |
59 | 0 | this.widget = widget; |
60 | 0 | } |
61 | ||
62 | public Widget getWidget() { | |
63 | 0 | return widget; |
64 | } | |
65 | ||
66 | public void setWidget(Widget widget) { | |
67 | 0 | this.widget = widget; |
68 | 0 | } |
69 | ||
70 | /** | |
71 | * Gets the type associated with this event. | |
72 | * | |
73 | * @return returns the handler type | |
74 | */ | |
75 | public static Type<SelectionChangeHandler> getType() { | |
76 | 0 | if (TYPE == null) { |
77 | 0 | TYPE = new Type<SelectionChangeHandler>(); |
78 | } | |
79 | 0 | return TYPE; |
80 | } | |
81 | ||
82 | /** | |
83 | * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) | |
84 | */ | |
85 | @Override | |
86 | protected void dispatch(SelectionChangeHandler handler) { | |
87 | 0 | handler.onSelectionChange(this); |
88 | 0 | } |
89 | ||
90 | /** | |
91 | * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() | |
92 | */ | |
93 | @Override | |
94 | public Type<SelectionChangeHandler> getAssociatedType() { | |
95 | 0 | return TYPE; |
96 | } | |
97 | ||
98 | public boolean isUserInitiated() { | |
99 | 0 | return userInitiated; |
100 | } | |
101 | ||
102 | public void setUserInitiated(boolean userInitiated) { | |
103 | 0 | this.userInitiated = userInitiated; |
104 | 0 | } |
105 | ||
106 | } |