1 | package gov.va.med.edp.widget.accessibility
|
---|
2 | {
|
---|
3 | import mx.accessibility.AccImpl;
|
---|
4 | import mx.controls.Label;
|
---|
5 | import flash.events.Event;
|
---|
6 | import flash.accessibility.Accessibility;
|
---|
7 | import flash.accessibility.AccessibilityProperties;
|
---|
8 | import mx.core.UIComponent;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * The AccessibleLabelAccImpl class is the accessibility class for
|
---|
12 | * Accessible label component.
|
---|
13 | *
|
---|
14 | * @tiptext This is the AccessibleLabelAccImpl Accessibility Class.
|
---|
15 | */
|
---|
16 | public class AccessibleLabelAccImpl extends AccImpl
|
---|
17 | {
|
---|
18 | /**
|
---|
19 | * @private
|
---|
20 | */
|
---|
21 | private static const EVENT_OBJECT_NAMECHANGE:uint = 0x800C;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @private
|
---|
25 | */
|
---|
26 | private const ROLE_SYSTEM_STATICTEXT:uint = 0x29;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @private
|
---|
30 | * Default Role of label component.
|
---|
31 | */
|
---|
32 | private const ROLE_SYSTEM_TEXT:uint = 0x0000002A;
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Constructor
|
---|
36 | */
|
---|
37 | public function AccessibleLabelAccImpl(master:UIComponent)
|
---|
38 | {
|
---|
39 | super(master);
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Method call for enabling accessibility for a component.
|
---|
44 | * this method is required for the compiler to activate
|
---|
45 | * the accessibility classes for a component.
|
---|
46 | */
|
---|
47 | public static function enableAccessibility():void
|
---|
48 | {
|
---|
49 | }
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * @private
|
---|
53 | * method for returning the name of the accessible label
|
---|
54 | *
|
---|
55 | * @param childID uint
|
---|
56 | *
|
---|
57 | * @return Name String
|
---|
58 | * @review
|
---|
59 | */
|
---|
60 | override protected function getName(childID:uint):String
|
---|
61 | {
|
---|
62 | var label:String = IAccessibleComponent(master).accessibleText;
|
---|
63 | return label != null && label != "" ? label : "";
|
---|
64 | }
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * @private
|
---|
68 | * Method for returning the state of the accessible label
|
---|
69 | *
|
---|
70 | * @param childID uint
|
---|
71 | *
|
---|
72 | * @return State uint
|
---|
73 | */
|
---|
74 | override public function get_accState(childID:uint):uint
|
---|
75 | {
|
---|
76 | var accState:uint = getState(childID);
|
---|
77 |
|
---|
78 | return accState;
|
---|
79 | }
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * @private
|
---|
83 | * Gets the role for the component.
|
---|
84 | *
|
---|
85 | * @param childID uint.
|
---|
86 | */
|
---|
87 | override public function get_accRole(childID:uint):uint
|
---|
88 | {
|
---|
89 | return ROLE_SYSTEM_TEXT ;
|
---|
90 | }
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * @private
|
---|
94 | * Array of events that we should listen for from the master component.
|
---|
95 | */
|
---|
96 | override protected function get eventsToHandle():Array
|
---|
97 | {
|
---|
98 | return super.eventsToHandle.concat(["labelChanged"]);
|
---|
99 | }
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * @private
|
---|
103 | * Override the generic event handler.
|
---|
104 | * All AccImpl must implement this to listen for events
|
---|
105 | * from its master component.
|
---|
106 | */
|
---|
107 | override protected function eventHandler(event:Event):void
|
---|
108 | {
|
---|
109 | switch (event.type)
|
---|
110 | {
|
---|
111 | /* tell JAWS to update and reread the information */
|
---|
112 | case "accessibleTextChanged":
|
---|
113 | {
|
---|
114 | Accessibility.sendEvent(master, 0, EVENT_OBJECT_NAMECHANGE);
|
---|
115 | Accessibility.updateProperties();
|
---|
116 | break;
|
---|
117 | }
|
---|
118 | }
|
---|
119 | }
|
---|
120 |
|
---|
121 |
|
---|
122 | }
|
---|
123 | }
|
---|