85 |
// Listener chain |
// Listener chain |
86 |
private ItemListener item_listeners; |
private ItemListener item_listeners; |
87 |
|
|
88 |
|
/** |
89 |
|
* This class provides accessibility support for the |
90 |
|
* combo box. |
91 |
|
* |
92 |
|
* @author Jerry Quinn (jlquinn@optonline.net) |
93 |
|
* @author Andrew John Hughes (gnu_andrew@member.fsf.org) |
94 |
|
*/ |
95 |
protected class AccessibleAWTChoice |
protected class AccessibleAWTChoice |
96 |
extends Component.AccessibleAWTComponent |
extends AccessibleAWTComponent |
97 |
implements AccessibleAction |
implements AccessibleAction |
98 |
{ |
{ |
99 |
|
|
100 |
|
/** |
101 |
|
* Serialization constant to match JDK 1.5 |
102 |
|
*/ |
103 |
|
private static final long serialVersionUID = 7175603582428509322L; |
104 |
|
|
105 |
|
/** |
106 |
|
* Default constructor which simply calls the |
107 |
|
* super class for generic component accessibility |
108 |
|
* handling. |
109 |
|
*/ |
110 |
|
public AccessibleAWTChoice() |
111 |
|
{ |
112 |
|
super(); |
113 |
|
} |
114 |
|
|
115 |
|
/** |
116 |
|
* Returns an implementation of the <code>AccessibleAction</code> |
117 |
|
* interface for this accessible object. In this case, the |
118 |
|
* current instance is simply returned (with a more appropriate |
119 |
|
* type), as it also implements the accessible action as well as |
120 |
|
* the context. |
121 |
|
* |
122 |
|
* @return the accessible action associated with this context. |
123 |
|
* @see javax.accessibility.AccessibleAction |
124 |
|
*/ |
125 |
public AccessibleAction getAccessibleAction() |
public AccessibleAction getAccessibleAction() |
126 |
{ |
{ |
127 |
return this; |
return this; |
128 |
} |
} |
129 |
|
|
130 |
// FIXME: I think this is right, but should be checked by someone who |
/** |
131 |
// knows better. |
* Returns the role of this accessible object. |
132 |
|
* |
133 |
|
* @return the instance of <code>AccessibleRole</code>, |
134 |
|
* which describes this object. |
135 |
|
* @see javax.accessibility.AccessibleRole |
136 |
|
*/ |
137 |
public AccessibleRole getAccessibleRole() |
public AccessibleRole getAccessibleRole() |
138 |
{ |
{ |
139 |
return AccessibleRole.POPUP_MENU; |
return AccessibleRole.COMBO_BOX; |
140 |
} |
} |
141 |
|
|
142 |
/* (non-Javadoc) |
/** |
143 |
|
* Returns the number of actions associated with this accessible |
144 |
|
* object. In this case, it is the number of choices available. |
145 |
|
* |
146 |
|
* @return the number of choices available. |
147 |
* @see javax.accessibility.AccessibleAction#getAccessibleActionCount() |
* @see javax.accessibility.AccessibleAction#getAccessibleActionCount() |
148 |
*/ |
*/ |
149 |
public int getAccessibleActionCount() |
public int getAccessibleActionCount() |
151 |
return pItems.size(); |
return pItems.size(); |
152 |
} |
} |
153 |
|
|
154 |
/* (non-Javadoc) |
/** |
155 |
|
* Returns a description of the action with the supplied id. |
156 |
|
* In this case, it is the text used in displaying the particular |
157 |
|
* choice on-screen. |
158 |
|
* |
159 |
|
* @param i the id of the choice whose description should be |
160 |
|
* retrieved. |
161 |
|
* @return the <code>String</code> used to describe the choice. |
162 |
* @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int) |
* @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int) |
163 |
*/ |
*/ |
164 |
public String getAccessibleActionDescription(int i) |
public String getAccessibleActionDescription(int i) |
166 |
return (String) pItems.get(i); |
return (String) pItems.get(i); |
167 |
} |
} |
168 |
|
|
169 |
/* (non-Javadoc) |
/** |
170 |
|
* Executes the action with the specified id. In this case, |
171 |
|
* calling this method provides the same behaviour as would |
172 |
|
* choosing a choice from the list in a visual manner. |
173 |
|
* |
174 |
|
* @param i the id of the choice to select. |
175 |
|
* @return true if a valid choice was specified. |
176 |
* @see javax.accessibility.AccessibleAction#doAccessibleAction(int) |
* @see javax.accessibility.AccessibleAction#doAccessibleAction(int) |
177 |
*/ |
*/ |
178 |
public boolean doAccessibleAction(int i) |
public boolean doAccessibleAction(int i) |