blob: ac98a83703c35fbf59f6ea7e22d2c98d1cbf6573 [file] [log] [blame]
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package mx.accessibility
{
import mx.collections.CursorBookmark;
import mx.collections.IViewCursor;
import mx.controls.ComboBox;
import mx.core.UIComponent;
import mx.core.mx_internal;
use namespace mx_internal;
/**
* ComboBoxAccImpl is a subclass of AccessibilityImplementation
* which implements accessibility for the ComboBox class.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public class ComboBoxAccImpl extends ComboBaseAccImpl
{
include "../core/Version.as";
//--------------------------------------------------------------------------
//
// Class methods
//
//--------------------------------------------------------------------------
/**
* Enables accessibility in the ComboBox class.
*
* <p>This method is called by application startup code
* that is autogenerated by the MXML compiler.
* Afterwards, when instances of ComboBox are initialized,
* their <code>accessibilityImplementation</code> property
* will be set to an instance of this class.</p>
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public static function enableAccessibility():void
{
ComboBox.createAccessibilityImplementation =
createAccessibilityImplementation;
ListAccImpl.enableAccessibility();
}
/**
* @private
* Creates a ComboBox's AccessibilityImplementation object.
* This method is called from UIComponent's
* initializeAccessibility() method.
*/
mx_internal static function createAccessibilityImplementation(
component:UIComponent):void
{
component.accessibilityImplementation =
new ComboBoxAccImpl(component);
}
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* Constructor.
*
* @param master The UIComponent instance that this AccImpl instance
* is making accessible.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function ComboBoxAccImpl(master:UIComponent)
{
super(master);
}
//--------------------------------------------------------------------------
//
// Overridden methods: AccImpl
//
//--------------------------------------------------------------------------
/**
* @private
* method for returning the name of the ComboBox
* Have to override getName as itemToLabel() is only in ComboBox
* The ListItem should return the label as the name with m of n string and
* ComboBox should return the name specified in the AccessibilityProperties.
*
* @param childID uint
*
* @return Name String
*/
override protected function getName(childID:uint):String
{
if (childID == 0)
return "";
var comboBox:ComboBox = ComboBox(master);
var iterator:IViewCursor = comboBox.collectionIterator;
iterator.seek(CursorBookmark.FIRST, childID - 1);
var item:Object = iterator.current;
return comboBox.itemToLabel(item);
}
}
}