1 | /* UpdateStaffEvent.as */
|
---|
2 |
|
---|
3 | package gov.va.med.edp.control.config
|
---|
4 | {
|
---|
5 | import com.adobe.cairngorm.control.CairngormEvent;
|
---|
6 |
|
---|
7 | import flash.events.Event;
|
---|
8 |
|
---|
9 | import gov.va.med.edp.vo.StaffMemberVO;
|
---|
10 |
|
---|
11 | public class UpdateStaffEvent extends CairngormEvent
|
---|
12 | {
|
---|
13 | public static const EVENT_ADD_STAFF: String = "AddStaff";
|
---|
14 | public static const EVENT_REMOVE_STAFF: String = "RemoveStaff";
|
---|
15 |
|
---|
16 | public var staff: StaffMemberVO;
|
---|
17 |
|
---|
18 | public function UpdateStaffEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
|
---|
19 | {
|
---|
20 | super(type, bubbles, cancelable);
|
---|
21 | }
|
---|
22 |
|
---|
23 | override public function clone():Event
|
---|
24 | {
|
---|
25 | return new UpdateStaffEvent(type);
|
---|
26 | }
|
---|
27 |
|
---|
28 | public static function dispatchAdd(staff : StaffMemberVO, role : String) : void {
|
---|
29 | if (staff == null) return;
|
---|
30 | var addEvent: UpdateStaffEvent = new UpdateStaffEvent(EVENT_ADD_STAFF);
|
---|
31 | addEvent.staff = staff;
|
---|
32 | addEvent.staff.role = role;
|
---|
33 | addEvent.staff.changed = true;
|
---|
34 | addEvent.dispatch();
|
---|
35 | }
|
---|
36 |
|
---|
37 | public static function dispatchRemove(staff : StaffMemberVO) : void {
|
---|
38 | if (staff == null) return;
|
---|
39 | var removeEvent: UpdateStaffEvent = new UpdateStaffEvent(EVENT_REMOVE_STAFF);
|
---|
40 | removeEvent.staff = staff;
|
---|
41 | removeEvent.dispatch();
|
---|
42 | }
|
---|
43 | }
|
---|
44 | }
|
---|