| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 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 | |
|
| 23 | |
|
| 24 | |
|
| 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 | |
|
| 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 | |
|
| 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 | |
|
| 72 | |
|
| 73 | |
|
| 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 | |
|
| 84 | |
|
| 85 | |
@Override |
| 86 | |
protected void dispatch(SelectionChangeHandler handler) { |
| 87 | 0 | handler.onSelectionChange(this); |
| 88 | 0 | } |
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 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 | |
} |